Skip to content
Myr

Add 100-continue test (#68)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by GitHub · parent 144ce4f · Browse files · 2 files+34 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+34 added−0 removed

  • tests:+34 added−0 removed

2 files+34 added−0 removed

modified:tests/client/test_async_client.py+13 added
109 unmodified lines
110 async with httpcore.AsyncClient() as client:111 response = await client.delete(url)112 assert response.status_code == 200113 assert response.text == "Hello, world!"114115116@pytest.mark.asyncio117async def test_100_continue(server):118 url = "http://127.0.0.1:8000/echo_body"119 headers = {"Expect": "100-continue"}120 data = b"Echo request body"121122 async with httpcore.AsyncClient() as client:123 response = await client.post(url, headers=headers, data=data)124125 assert response.status_code == 200126 assert response.content == data
modified:tests/conftest.py+21 added
10 unmodified lines
11 if scope["path"] == "/slow_response":12 await slow_response(scope, receive, send)13 elif scope["path"].startswith("/status"):14 await status_code(scope, receive, send)15 elif scope["path"].startswith("/echo_body"):16 await echo_body(scope, receive, send)17 else:18 await hello_world(scope, receive, send)1920
31 unmodified lines
52 )53 await send({"type": "http.response.body", "body": b"Hello, world!"})545556async def echo_body(scope, receive, send):57 body = b''58 more_body = True5960 while more_body:61 message = await receive()62 body += message.get('body', b'')63 more_body = message.get('more_body', False)6465 await send(66 {67 "type": "http.response.start",68 "status": 200,69 "headers": [[b"content-type", b"text/plain"]],70 }71 )72 await send({"type": "http.response.body", "body": body})737475@pytest.fixture76def cert_and_key_paths():77 ca = trustme.CA()78 ca.issue_cert("example.org")
33 unmodified lines