Browse Source

Merge pull request #819 from nextcloud/feat/dynamite/octet_stream

Feat/dynamite/octet stream
pull/585/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
9def89d43b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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