-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
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
[dart-dio] multi-part file should accept filename #6671
Comments
I don't seem to be able to generate dart-dio with
|
This should be working by now, can you check on master? |
Hi, this is still not working, because the generated methods still take Uint8List so there is no way to pass the filename to them, like this:
Here I would expect to pass MultipartFile and do fromBytes in my application with the filename. |
@kuhnroyal how this supposed to work? |
Yea looks like this needs more work, filename is always the same as the parameter name. |
Can we please re-open this issue? |
The fix is very easy - pass entire MultipartFile as argument not the Uint8List. We can make it dynamic for backward compatibility and check type |
Here is a pull request with a breaking change: the generated api methods now accept MultipartFile instead of Uint8List which I think is more logical. |
This is your issue, you should be able to re-open it? It is not locked. |
@kuhnroyal I can't re-open it because I did not close it myself |
* 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
* [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 #6671 * fixes #9079 * Add and fix tests * Only use MultipartFile for body/multipart parameters * Fix test * Actually fix tests
…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
Right now multipart forms methods are generated with
Uint8List
type fields and hard-coded filename as the field name:Which is incorrect, unsuitable for certain backends.
I think it is more suitable to generate these fields as
MultipartFile
and let the upstream handle the MultipartFile generation, just likedart
generator does.The text was updated successfully, but these errors were encountered: