-
-
Notifications
You must be signed in to change notification settings - Fork 188
Description
When sending repeated, correctly formatted application/x-www-form-urlencoded POST requests to a Quart endpoint, the server occasionally returns a 400 Bad Request. These same requests succeed initially and are identical each time, suggesting a potential bug in request parsing or stream handling.
from quart import Quart, request, jsonify
app = Quart(__name__)
@app.route("/", methods=["POST"])
async def test():
form = await request.form
return jsonify({"value": form["value"]})
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8080, debug=True)
Send 5-10 identical form POSTs at 200ms intervals. After a few, server returns 400. This can't be the code's fault, because it never runs. Its just the quart framework thats rejecting the request, saying its bad or malformed, when its completely fine.
So in this instance, we should get "test" to be printed, and the value we got to be returned, but it just doesnt do that when this fails and returns error code 400 to the server that sent the request.
Environment:
- Python version: 3.10.11
- Quart version: 0.19.3