Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: optionally pass request to before_record_response #556

Open
therefromhere opened this issue Aug 24, 2020 · 3 comments · May be fixed by #679
Open

Feature request: optionally pass request to before_record_response #556

therefromhere opened this issue Aug 24, 2020 · 3 comments · May be fixed by #679

Comments

@therefromhere
Copy link

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?

@therefromhere
Copy link
Author

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.

@grutts
Copy link

grutts commented Feb 24, 2021

+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

@edthedev
Copy link

There's related discussion in #527 about working around not having access to request in before_record_response.

tzturner added a commit to zdc217/vcrpy that referenced this issue Jan 19, 2023
Closes kevin1024#556 kevin1024#527

Co-authored-by: Edward Delaporte (@edthedev)
Co-authored-by: David Riddle (@ddriddle)
Co-authored-by: Michelle Pitcel (@mpitcel)
Co-authored-by: Zach Carrington (@zdc)
tzturner added a commit to zdc217/vcrpy that referenced this issue Jan 19, 2023
Closes kevin1024#556 kevin1024#527

Co-authored-by: Edward Delaporte (@edthedev)
Co-authored-by: David Riddle (@ddriddle)
Co-authored-by: Michelle Pitcel (@mpitcel)
Co-authored-by: Zach Carrington (@zdc217)
tzturner added a commit to zdc217/vcrpy that referenced this issue Jan 19, 2023
Closes kevin1024#556 kevin1024#527

Co-authored-by: Edward Delaporte (@edthedev)
Co-authored-by: David Riddle (@ddriddle)
Co-authored-by: Michelle Pitcel (@mpitcel)
Co-authored-by: Zach Carrington (@zdc217)
@tzturner tzturner linked a pull request Jan 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants