MCPcopy
hub / github.com/pallets/flask / test_bad_request_debug_message

Function test_bad_request_debug_message

tests/test_json.py:15–27  ·  view source on GitHub ↗
(app, client, debug)

Source from the content-addressed store, hash-verified

13
14@pytest.mark.parametrize("debug", (True, False))
15def 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
30def test_json_bad_requests(app, client):

Callers

nothing calls this directly

Calls 1

postMethod · 0.45

Tested by

no test coverage detected