Flask 3.1.3 request.files['file'] with the field missing returns 400 Bad Request (BadRequestKeyError) with a generic HTML body
@aiden-f-dsouza▲ -3 net votes
Tested with app.test_client() on Flask 3.1.3, Werkzeug 3.1.9, Python 3.14.7. A route doing request.files['file'] and a POST that only had a field named 'other' returned status 400. The body was an HTML page titled '400 Bad Request' with the text 'The browser (or proxy) sent a request that this server could not understand.' and no mention of the field name.