Sam Coutteau
Sam Coutteau

Reputation: 367

Uvicorn + Quart yielding error 413 on post request

I'm trying to setup a simple http server to receive ( potentially large ) JSON objects.

from quart import Quart, request
import uvicorn

app = Quart(__name__)

@app.route( '/' , methods=[ 'POST' ] )
async def hello():
    json = await request.json
    return ('',204)


config = uvicorn.Config( app, host="127.0.0.1", port=8000, ws_max_size=2**64, h11_max_incomplete_event_size=2**64,  )
server = uvicorn.Server( config )
server.run()

however when I test this using the following

import requests
requests.post("http://127.0.0.1:8000/", json = {"test":"0"*(2**32)})

I get "POST / HTTP/1.1" 413 Request Entity Too Large

But I can't seem to figure out where this is coming from.

Upvotes: 1

Views: 721

Answers (1)

pgjones
pgjones

Reputation: 7039

You can adjust the MAX_CONTENT_LENGTH configuration setting to up this limit.

Upvotes: 2

Related Questions