Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com>
@ -144,11 +144,9 @@ class OpenAPIBuilder implements Builder {
),
)
..body = Block.of([
const Code('final data = await response.bodyBytes;'),
const Code(''),
const Code('String body;'),
const Code('try {'),
const Code('body = utf8.decode(data);'),
const Code('body = await response.body;'),
const Code('} on FormatException {'),
const Code("body = 'binary';"),
const Code('}'),
@ -1,6 +1,5 @@
// ignore_for_file: camel_case_types
// ignore_for_file: public_member_api_docs
import 'dart:convert';
import 'dart:typed_data';
import 'package:built_collection/built_collection.dart';
@ -34,11 +33,9 @@ class CoreApiException extends DynamiteApiException {
);
static Future<CoreApiException> fromResponse(final HttpClientResponse response) async {
final data = await response.bodyBytes;
String body;
try {
body = utf8.decode(data);
body = await response.body;
} on FormatException {
body = 'binary';
}
@ -34,11 +33,9 @@ class FilesSharingApiException extends DynamiteApiException {
static Future<FilesSharingApiException> fromResponse(final HttpClientResponse response) async {
@ -34,11 +33,9 @@ class NewsApiException extends DynamiteApiException {
static Future<NewsApiException> fromResponse(final HttpClientResponse response) async {
@ -34,11 +34,9 @@ class NotesApiException extends DynamiteApiException {
static Future<NotesApiException> fromResponse(final HttpClientResponse response) async {
@ -34,11 +33,9 @@ class NotificationsApiException extends DynamiteApiException {
static Future<NotificationsApiException> fromResponse(final HttpClientResponse response) async {
@ -34,11 +33,9 @@ class ProvisioningApiApiException extends DynamiteApiException {
static Future<ProvisioningApiApiException> fromResponse(final HttpClientResponse response) async {
import 'package:built_value/built_value.dart';
@ -32,11 +31,9 @@ class SettingsApiException extends DynamiteApiException {
static Future<SettingsApiException> fromResponse(final HttpClientResponse response) async {
@ -34,11 +33,9 @@ class ThemingApiException extends DynamiteApiException {
static Future<ThemingApiException> fromResponse(final HttpClientResponse response) async {
@ -33,11 +32,9 @@ class UppushApiException extends DynamiteApiException {
static Future<UppushApiException> fromResponse(final HttpClientResponse response) async {
@ -34,11 +33,9 @@ class UserStatusApiException extends DynamiteApiException {
static Future<UserStatusApiException> fromResponse(final HttpClientResponse response) async {
@ -55,7 +55,7 @@ class WebDavClient {
throw DynamiteApiException(
response.statusCode,
response.responseHeaders,
utf8.decode(await response.bodyBytes),
await response.body,