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

Function test_chunked_encoding

tests/test_requests.py:488–502  ·  tests/test_requests.py::test_chunked_encoding
(test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

486
487
488def test_chunked_encoding(test_client_factory: TestClientFactory) -> None:
489 async def app(scope: Scope, receive: Receive, send: Send) -> None:
490 request = Request(scope, receive)
491 body = await request.body()
492 response = JSONResponse({class="st">"body": body.decode()})
493 await response(scope, receive, send)
494
495 client = test_client_factory(app)
496
497 def post_body() -> Iterator[bytes]:
498 yield bclass="st">"foo"
499 yield bclass="st">"bar"
500
501 response = client.post(class="st">"/", data=post_body()) class="cm"># type: ignore
502 assert response.json() == {class="st">"body": class="st">"foobar"}
503
504
505def test_request_send_push_promise(test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 4

test_client_factoryFunction · 0.85
post_bodyFunction · 0.85
jsonMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected