forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dart][dart-dio-next] Improve support for file uploads (OpenAPITools#…
…9542) * [dart][dart-dio] Improve support for file uploads * add support for filenames in multipart requests by using `MultipartFile` from dio directly * add support for binary/file body data * fixes OpenAPITools#6671 * fixes OpenAPITools#9079 * Add and fix tests * Only use MultipartFile for body/multipart parameters * Fix test * Actually fix tests
- Loading branch information
Showing
10 changed files
with
146 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,6 @@ jobs: | |
- ~/.bundle | ||
- ~/.go_workspace | ||
- ~/.gradle | ||
- ~/.pub-cache | ||
- ~/.cache/bower | ||
- ".git" | ||
- ~/.stack | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...erator/src/main/resources/dart/libraries/dio/serialization/built_value/serialize.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...petstore/dart-dio-next/petstore_client_lib_fake_tests/test/matcher/form_data_matcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:dio/dio.dart'; | ||
import 'package:meta/meta.dart'; | ||
import 'package:collection/collection.dart'; | ||
import 'package:http_mock_adapter/src/matchers/matcher.dart'; | ||
|
||
class FormDataMatcher extends Matcher { | ||
final FormData expected; | ||
|
||
const FormDataMatcher({@required this.expected}); | ||
|
||
@override | ||
bool matches(dynamic actual) { | ||
if (actual is! FormData) { | ||
return false; | ||
} | ||
final data = actual as FormData; | ||
return MapEquality<String, String>().equals( | ||
Map.fromEntries(expected.fields), | ||
Map.fromEntries(data.fields), | ||
) && | ||
MapEquality<String, MultipartFile>().equals( | ||
Map.fromEntries(expected.files), | ||
Map.fromEntries(data.files), | ||
); | ||
} | ||
} |