| 212 | |
| 213 | |
| 214 | def test_request_generator_content_picklable(): |
| 215 | def content() -> typing.Iterator[bytes]: |
| 216 | yield b"test 123" # pragma: no cover |
| 217 | |
| 218 | request = httpx.Request("POST", "http://example.org", content=content()) |
| 219 | pickle_request = pickle.loads(pickle.dumps(request)) |
| 220 | with pytest.raises(httpx.RequestNotRead): |
| 221 | pickle_request.content # noqa: B018 |
| 222 | with pytest.raises(httpx.StreamClosed): |
| 223 | pickle_request.read() |
| 224 | |
| 225 | request = httpx.Request("POST", "http://example.org", content=content()) |
| 226 | request.read() |
| 227 | pickle_request = pickle.loads(pickle.dumps(request)) |
| 228 | assert pickle_request.content == b"test 123" |
| 229 | |
| 230 | |
| 231 | def test_request_params(): |