mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
aiohttp: Check if the response is playable before redirecting
This commit is contained in:
committed by
Kevin McCarthy
parent
4897a8e692
commit
b64e93aff2
@@ -134,7 +134,10 @@ def play_responses(cassette, vcr_request):
|
|||||||
# may have edge cases based on the headers we're providing (e.g. if
|
# may have edge cases based on the headers we're providing (e.g. if
|
||||||
# there's a matcher that is used to filter by headers).
|
# there's a matcher that is used to filter by headers).
|
||||||
vcr_request = Request("GET", str(next_url), None, _serialize_headers(response.request_info.headers))
|
vcr_request = Request("GET", str(next_url), None, _serialize_headers(response.request_info.headers))
|
||||||
vcr_request = cassette.find_requests_with_most_matches(vcr_request)[0][0]
|
vcr_requests = cassette.find_requests_with_most_matches(vcr_request)
|
||||||
|
for vcr_request, *_ in vcr_requests:
|
||||||
|
if cassette.can_play_response_for(vcr_request):
|
||||||
|
break
|
||||||
|
|
||||||
# Tack on the response we saw from the redirect into the history
|
# Tack on the response we saw from the redirect into the history
|
||||||
# list that is added on to the final response.
|
# list that is added on to the final response.
|
||||||
|
|||||||
Reference in New Issue
Block a user