def test_raw_iterator(server): with httpcore.SyncClient() as http: response = http.get("http://127.0.0.1:8000/", stream=True) assert response.status_code == 200 body = b"" for chunk in response.raw(): body += chunk assert body == b"Hello, world!"
def test_post(server): with httpcore.SyncClient() as http: response = http.post("http://127.0.0.1:8000/", content=b"Hello, world!") assert response.status_code == 200 assert response.reason_phrase == "OK"
def test_stream_response(server): with httpcore.SyncClient() as http: response = http.get("http://127.0.0.1:8000/", stream=True) assert response.status_code == 200 content = response.read() assert content == b"Hello, world!"
def test_get(server): with httpcore.SyncClient() as http: response = http.get("http://127.0.0.1:8000/") assert response.status_code == 200 assert response.content == b"Hello, world!" assert response.text == "Hello, world!"