I have an FastAPI endpoint for handling file uploads that looks something like this:
@app.post('/upload')
async def accept_some_file(f: UploadFile):
content = await f.read()
# ... do stuff with content and generate a response
but this appears to only work with multipart/form-data encoded payloads.
I'd like to be able to send file bytes directly through a request that looks like this:
POST /upload HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.79.1
Accept: */*
Content-Type: image/jpeg
Content-Length: 11044
... image bytes
Is there a FastAPI setting I can use to allow this? Or is there another request type that makes more sense for this use case?