| 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): |