-
Notifications
You must be signed in to change notification settings - Fork 37
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
Support for binary / file types #282
Comments
Unfortunately, currently, if the request_body_schema is specified, it must conform to a application/json content-type. flask-rebar/flask_rebar/rebar.py Lines 129 to 130 in da6b163
What you would do in the case where you wanted to use a multipart/form-data, is not specify the request_body_schema, and validate it inside of the request instead. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to figure out if there is currently support in rebar for doing a POST to upload a file / binary data?
I've been following flask's document for file uploads and created a simple rebar example.
We can then make a request to this API like
But I get the error
{'message': "Only payloads with 'content-type' 'application/json' are supported."}
The headers of the request are
'Content-Type': 'multipart/form-data'
which makes sense, given that the upload was for binary data. Should I be defining rebar differently? It seems to work if I completely get rid of therequest_body_schema
, since then it's not doing any validation. Swagger does support file type definitions, so there should be some way to define them within flask / rebar.The text was updated successfully, but these errors were encountered: