Closed T-256 closed 1 year ago
Hi @T-256 ,
Thanks for taking the time to investigate this. Indeed if this is an issue, we could consider creating the response only upon entering the callback. This should not break any compatibility (as you are already not expected to provide mutables, unless you know what you are doing anyway). The performance impact should be rather small, and somehow closer to real httpx performances anyway.
This should be fixed in version 0.23.0 available on pypi.
I added a test case to ensure non regression on this in 0.23.1.
The issue is essentially that a single response instance is being returned by the
httpx_mock
transport, and being reused._Originally posted by @tomchristie in https://github.com/encode/httpx/pull/2777#discussion_r1277523022_