-
Notifications
You must be signed in to change notification settings - Fork 333
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
Upload list of files using restX + Swagger #177
Comments
Im also having this issue. It appears to be similar to this: noirbizarre/flask-restplus#463 |
I tried forcing the content type with the decorator and the argument location as 'headers' as in the documentation |
I Tried the same code and uploaded multiple files got to knew that if
output{'file': None} &&&&&&&& Could anyone help me on this while uploading multiple files how to get the filenames and swagger documentation for that as well |
I am also having the same problem... |
I think the problem is coming from the line flask-restx/flask_restx/swagger.py Line 469 in af807aa
It works when I replaced it by
|
This actually does not seem to be supported in Swagger UI currently. See Swagger Docs and GitHub Issue. |
This solves the issue for me. |
Indeed, not sure why it worked for a while... Used for tests: |
Any updates on this issue? |
PR is still not approved. So you have to fork and merge for yourself |
Thank you! |
… accounts for multiple arguments as part of the form and sets the correct "consumes" values so that "multipart/form-data" gets submitted, as with a single file, when a list of files is present.
Mentioning fix of bug python-restx#177
#542 PR in for this issue, takes @jingapore solution slightly further resolving issues with list comprehensions for keys that do not always exist in the dict & corresponding unit test. |
Hey,
I'm trying to upload a list of files to my post method using the swaggerUI
I am defining my input using RequestParser and add_argument method.
Uploading one file works just fine, but once I'm adding 'action=append' to make it a list of files it doesn't work.
my code looks like this:
This is the cUrl from swagger:
curl -X POST "http://127.0.0.1:8000/" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "images=%5Bobject%20File%5D&images=%5Bobject%20File%5D"
And the problem is that swagger sends it as
application/x-www-form-urlencoded
and notmultipart/form-data
Saying again, if I don't add the
action='append'
to theadd_argument
method, and I only send one file using Swagger it sends it asmultipart/form-data
Is there any way to control it?
The text was updated successfully, but these errors were encountered: