MCPcopy
hub / github.com/encode/starlette / test_request_form_urlencoded

Function test_request_form_urlencoded

tests/test_requests.py:122–132  ·  tests/test_requests.py::test_request_form_urlencoded
(test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

120
121
122def test_request_form_urlencoded(test_client_factory: TestClientFactory) -> None:
123 async def app(scope: Scope, receive: Receive, send: Send) -> None:
124 request = Request(scope, receive)
125 form = await request.form()
126 response = JSONResponse({class="st">"form": dict(form)})
127 await response(scope, receive, send)
128
129 client = test_client_factory(app)
130
131 response = client.post(class="st">"/", data={class="st">"abc": class="st">"123 @"})
132 assert response.json() == {class="st">"form": {class="st">"abc": class="st">"123 @"}}
133
134
135def test_request_form_context_manager(test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 3

test_client_factoryFunction · 0.85
jsonMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected