diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index 51780b65..b559f72b 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -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('}'), diff --git a/packages/nextcloud/lib/src/api/core.openapi.dart b/packages/nextcloud/lib/src/api/core.openapi.dart index e041d2e3..a4e7a475 100644 --- a/packages/nextcloud/lib/src/api/core.openapi.dart +++ b/packages/nextcloud/lib/src/api/core.openapi.dart @@ -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 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'; } diff --git a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart index 03029f14..c71a6ad5 100644 --- a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart @@ -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 FilesSharingApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/news.openapi.dart b/packages/nextcloud/lib/src/api/news.openapi.dart index 187200b5..5e990249 100644 --- a/packages/nextcloud/lib/src/api/news.openapi.dart +++ b/packages/nextcloud/lib/src/api/news.openapi.dart @@ -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 NewsApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/notes.openapi.dart b/packages/nextcloud/lib/src/api/notes.openapi.dart index 6fbd34cd..e4d14928 100644 --- a/packages/nextcloud/lib/src/api/notes.openapi.dart +++ b/packages/nextcloud/lib/src/api/notes.openapi.dart @@ -34,11 +34,9 @@ class NotesApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/notifications.openapi.dart b/packages/nextcloud/lib/src/api/notifications.openapi.dart index 371ab584..be8cbc3c 100644 --- a/packages/nextcloud/lib/src/api/notifications.openapi.dart +++ b/packages/nextcloud/lib/src/api/notifications.openapi.dart @@ -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 NotificationsApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart index cf0e79d1..0778324e 100644 --- a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart +++ b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart @@ -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 ProvisioningApiApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/settings.openapi.dart b/packages/nextcloud/lib/src/api/settings.openapi.dart index 05315923..51e46cce 100644 --- a/packages/nextcloud/lib/src/api/settings.openapi.dart +++ b/packages/nextcloud/lib/src/api/settings.openapi.dart @@ -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_value/built_value.dart'; @@ -32,11 +31,9 @@ class SettingsApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/theming.openapi.dart b/packages/nextcloud/lib/src/api/theming.openapi.dart index aadcdfe8..b4ded87e 100644 --- a/packages/nextcloud/lib/src/api/theming.openapi.dart +++ b/packages/nextcloud/lib/src/api/theming.openapi.dart @@ -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 ThemingApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/uppush.openapi.dart b/packages/nextcloud/lib/src/api/uppush.openapi.dart index 94e15074..e52587e7 100644 --- a/packages/nextcloud/lib/src/api/uppush.openapi.dart +++ b/packages/nextcloud/lib/src/api/uppush.openapi.dart @@ -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'; @@ -33,11 +32,9 @@ class UppushApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/api/user_status.openapi.dart b/packages/nextcloud/lib/src/api/user_status.openapi.dart index d408feab..b52a6b83 100644 --- a/packages/nextcloud/lib/src/api/user_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/user_status.openapi.dart @@ -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 UserStatusApiException extends DynamiteApiException { ); static Future 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'; } diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index 6eb94583..6d1b49b0 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -55,7 +55,7 @@ class WebDavClient { throw DynamiteApiException( response.statusCode, response.responseHeaders, - utf8.decode(await response.bodyBytes), + await response.body, ); }