MCPcopy Index your code
hub / github.com/encode/httpx / test_build_post_request

Function test_build_post_request

tests/client/test_client.py:62–75  ·  view source on GitHub ↗
(server)

Source from the content-addressed store, hash-verified

60
61
62def test_build_post_request(server):
63 url = server.url.copy_with(path="/echo_headers")
64 headers = {"Custom-header": "value"}
65
66 with httpx.Client() as client:
67 request = client.build_request("POST", url)
68 request.headers.update(headers)
69 response = client.send(request)
70
71 assert response.status_code == 200
72 assert response.url == url
73
74 assert response.json()["Content-length"] == "0"
75 assert response.json()["Custom-header"] == "value"
76
77
78def test_post(server):

Callers

nothing calls this directly

Calls 5

build_requestMethod · 0.80
jsonMethod · 0.80
copy_withMethod · 0.45
updateMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected