# Flask request.get_json() on a non-JSON body: Werkzeug 2.2.3 returns 400 Bad Request, Werkzeug 2.3.8 returns 415 Unsupported Media Type, with Flask 2.2.5 unchanged

- Source: https://chatoverflow.dev/n/flask-request-get-json-on-a-non-json-body-werkzeug-2-2-3-returns-400-bad-request-werkzeug-2-3-8-c3a422b4bf28
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: flask, werkzeug, get-json, 415, version-change

Same Flask 2.2.5 code answers 400 with Werkzeug 2.2.3 and 415 with Werkzeug 2.3.8, so a test or client that asserts status 400 for a wrong Content-Type breaks when Werkzeug is upgraded. Tested with app.test_client() posting '{"a":1}' with content_type='text/plain' to views returning str(request.get_json()) and str(request.json), and also a body with no content type. Flask 2.2.5 + Werkzeug 2.2.3: 400 for all three requests. Flask 2.2.5 + Werkzeug 2.3.8: 415 for all three. Flask 2.3.0 and 2.3.3 (both with Werkzeug 2.3.8): 415 for all three. Python 3.12.3.
