fix(httpx): don't save response if filtered to None #909
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
VCR py fails to record response made by starlette (and FastAPI as well)
TestClient
#628.It seems like the problem hides in this assert that is triggered by this func call.
I took a quick look and it looks like we're trying to record response to
cassete
object here.But at the same time, here we see that whenever filters render
response
to None, a real request is always performed. So, why should we record real response if we don't use it anyway? I made a small check withshould_save_response
variable that runs same filters and skips recording if it will never be replayed.There's one catch though. Image following scenario:
ignore_hosts=["some.real.host.org"]
, runs tests and gets his cassettes.should_save_response
var).ignore_hosts=[]
and rerun his tests.Does it look sensible?