Skip to content
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

Raw request #465

Open
jcampbell05 opened this issue Aug 3, 2023 · 2 comments
Open

Raw request #465

jcampbell05 opened this issue Aug 3, 2023 · 2 comments
Labels

Comments

@jcampbell05
Copy link

Hey, so we would like to consume the raw request, but it seems it's not possible. The reason for doing this is the body contains binary data we need to consume as is.

@greyli
Copy link
Member

greyli commented Aug 5, 2023

Could you provide some minimal examples? What's your request data look like? If it's not related to OpenAPI generation, you may need to request this feature in Flask itself.

@jcampbell05
Copy link
Author

Could you provide some minimal examples? What's your request data look like? If it's not related to OpenAPI generation, you may need to request this feature in Flask itself.

Yes so the request will look like this:

POST /upload
Content-Type: image.jpeg
Body: <image data>

We can grab the reqeust data from flask like so:

from flask import request
from apiflask import App

app = App()

@app.post('/upload')
def upload():
   request.body # Do something with the body

The issue is there isn't anyway to tell APIFlask to emit a spec which indicates the endpoint accepts binary data as the body nor does there seem to be a way override manually the generated spec via the api.doc decorator when we need to bypass the default behaviour beyond a global app level decorator which is a bit more complicated to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants