MCPcopy
hub / github.com/psf/requests / test_prepared_request_hook

Method test_prepared_request_hook

tests/test_requests.py:1199–1211  ·  view source on GitHub ↗
(self, httpbin)

Source from the content-addressed store, hash-verified

1197 assert prep.hooks["response"] == [hook1]
1198
1199 def test_prepared_request_hook(self, httpbin):
1200 def hook(resp, **kwargs):
1201 resp.hook_working = True
1202 return resp
1203
1204 req = requests.Request("GET", httpbin(), hooks={"response": hook})
1205 prep = req.prepare()
1206
1207 s = requests.Session()
1208 s.proxies = getproxies()
1209 resp = s.send(prep)
1210
1211 assert hasattr(resp, "hook_working")
1212
1213 def test_prepared_from_session(self, httpbin):
1214 class DummyAuth(requests.auth.AuthBase):

Callers

nothing calls this directly

Calls 3

prepareMethod · 0.95
sendMethod · 0.95
httpbinFunction · 0.85

Tested by

no test coverage detected