We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior: I have defined the api as:
@post('') Future saveProfileGreetings( @part() File file, @part() String link, @SendProgress() ProgressCallback onSendProgress, );
This works fine but I want to assign content type on MultipartFile by looking up mime type.
Expected behavior I want to generate the api as the following where i can set content type as :
contentType: MediaType.parse(lookupMimeType(file.path)!),
@OverRide Future saveProfileGreetings( File file, String link, void Function(int, int) onSendProgress, ) async { final _extra = <String, dynamic>{}; final queryParameters = <String, dynamic>{}; final _headers = <String, dynamic>{}; final _data = FormData(); _data.files.add(MapEntry( 'file', MultipartFile.fromFileSync( file.path, filename: file.path.split(Platform.pathSeparator).last, contentType: MediaType.parse(lookupMimeType(file.path)!), ), )); _data.fields.add(MapEntry( 'link', link, )); await _dio.fetch(_setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, contentType: 'multipart/form-data', ) .compose( _dio.options, '', queryParameters: queryParameters, data: _data, onSendProgress: onSendProgress, ) .copyWith( baseUrl: _combineBaseUrls( _dio.options.baseUrl, baseUrl, )))); }
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
I have defined the api as:
@post('')
Future saveProfileGreetings(
@part() File file,
@part() String link,
@SendProgress() ProgressCallback onSendProgress,
);
This works fine but I want to assign content type on MultipartFile by looking up mime type.
Expected behavior
I want to generate the api as the following where i can set content type as :
@OverRide
Future saveProfileGreetings(
File file,
String link,
void Function(int, int) onSendProgress,
) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = FormData();
_data.files.add(MapEntry(
'file',
MultipartFile.fromFileSync(
file.path,
filename: file.path.split(Platform.pathSeparator).last,
contentType: MediaType.parse(lookupMimeType(file.path)!),
),
));
_data.fields.add(MapEntry(
'link',
link,
));
await _dio.fetch(_setStreamType(Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
.compose(
_dio.options,
'',
queryParameters: queryParameters,
data: _data,
onSendProgress: onSendProgress,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
}
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: