Browse Source

dynamite: Output accept header

pull/219/head
jld3103 2 years ago
parent
commit
b63536f99b
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 12
      packages/dynamite/lib/src/openapi_builder.dart

12
packages/dynamite/lib/src/openapi_builder.dart

@ -584,10 +584,20 @@ class OpenAPIBuilder implements Builder {
..._descriptionToDocs(operation.description), ..._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(''' final code = StringBuffer('''
var path = '$path'; var path = '$path';
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
final headers = <String, String>{}; final headers = <String, String>{${acceptHeader != null ? "'Accept': '$acceptHeader'," : ''}};
Uint8List? body; Uint8List? body;
'''); ''');

Loading…
Cancel
Save