diff --git a/packages/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/lib/src/openapi_builder.dart index 1c605fff..c0292baf 100644 --- a/packages/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/lib/src/openapi_builder.dart @@ -584,10 +584,20 @@ class OpenAPIBuilder implements Builder { ..._descriptionToDocs(operation.description), ]); + final acceptHeader = operation.responses?.values + .map((final response) => response.content?.keys) + .reduce( + (final a, final b) => [ + ...a ?? [], + ...b ?? [], + ], + ) + ?.toSet() + .join(','); final code = StringBuffer(''' var path = '$path'; final queryParameters = {}; - final headers = {}; + final headers = {${acceptHeader != null ? "'Accept': '$acceptHeader'," : ''}}; Uint8List? body; ''');