| 13 | |
| 14 | @pytest.mark.parametrize("debug", (True, False)) |
| 15 | def test_bad_request_debug_message(app, client, debug): |
| 16 | app.config["DEBUG"] = debug |
| 17 | app.config["TRAP_BAD_REQUEST_ERRORS"] = False |
| 18 | |
| 19 | @app.route("/json", methods=["POST"]) |
| 20 | def post_json(): |
| 21 | flask.request.get_json() |
| 22 | return None |
| 23 | |
| 24 | rv = client.post("/json", data=None, content_type="application/json") |
| 25 | assert rv.status_code == 400 |
| 26 | contains = b"Failed to decode JSON object" in rv.data |
| 27 | assert contains == debug |
| 28 | |
| 29 | |
| 30 | def test_json_bad_requests(app, client): |