vcrpy
vcrpy copied to clipboard
Undocumented 599 (could not replay request) status in aiohttp and tornado
trafficstars
Just ran into an issue where I was receiving 599 status code.
Digging into the source revealed it means No match for the request {!r} was found. Can't overwrite existing cassette {!r} in your current record mode {!r}..
I couldn't see the helpful error message because I was testing a 3rd party api call deep in my e2e tests.
Would be useful to document this.
if cassette.write_protected and cassette.filter_request(vcr_request):
response = MockClientResponse(method, URL(url))
response.status = 599
msg = (
"No match for the request {!r} was found. Can't overwrite "
"existing cassette {!r} in your current record mode {!r}."
)
msg = msg.format(vcr_request, cassette._path, cassette.record_mode)
response._body = msg.encode()
response.close()
return response
This error should be send to the logger at least.
Would be nice to pass the cassette to before_record_request. This way we could access can replay and do our own logging.