Browse Source

feat(dynamite): fully support mimeType application/octet-stream

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/819/head
Nikolas Rimikis 1 year ago
parent
commit
30adf3ca31
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 5
      packages/dynamite/dynamite/lib/src/models/type_result/type_result.dart

5
packages/dynamite/dynamite/lib/src/models/type_result/type_result.dart

@ -87,6 +87,11 @@ sealed class TypeResult {
return 'json.encode($serialized)'; return 'json.encode($serialized)';
case 'application/x-www-form-urlencoded': case 'application/x-www-form-urlencoded':
return 'Uri(queryParameters: $serialized! as Map<String, dynamic>).query'; return 'Uri(queryParameters: $serialized! as Map<String, dynamic>).query';
case 'application/octet-stream':
if (className != 'Uint8List') {
throw Exception('octet-stream can only be applied to binary data. Expected Uint8List but got $className');
}
return '$object as Uint8List';
default: default:
throw Exception('Can not encode mime type "$mimeType"'); throw Exception('Can not encode mime type "$mimeType"');
} }

Loading…
Cancel
Save