vcrpy
vcrpy copied to clipboard
Feature request: optionally pass request to before_record_response
It would sometimes be useful to know which endpoint we're working with during before_record_response - but I think that's not currently possible.
What do you think to allowing before_record_response to have an optional request argument, and passing the request dict if it's present?
My use case for this is: One of the endpoints I work with returns a list of data in arbitrary order - I'd like to sort that in before_record_response to minimise the diffs in my fixture cassettes, but I'd like to only apply this sorting to this one endpoint that I know it's safe for.
+1
This would be really useful. There are some requests it would be handy to filter the responses of (based on the URI) but because this is inaccessible in the response, we can't do anything
In principle I'd be happy to look at implementing it if the feature would be accepted
There's related discussion in #527 about working around not having access to request in before_record_response.