MCPcopy
hub / github.com/pallets/werkzeug / test_environ_builder_json

Function test_environ_builder_json

tests/test_test.py:192–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190
191
192def test_environ_builder_json():
193 @Request.application
194 def app(request):
195 assert request.content_type == "application/json"
196 return Response(json.loads(request.get_data(as_text=True))["foo"])
197
198 c = Client(app)
199 response = c.post("/", json={"foo": "bar"})
200 assert response.text == "bar"
201
202 with pytest.raises(TypeError):
203 c.post("/", json={"foo": "bar"}, data={"baz": "qux"})
204
205
206def test_environ_builder_headers():

Callers

nothing calls this directly

Calls 2

postMethod · 0.95
ClientClass · 0.90

Tested by

no test coverage detected