-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
feat: pass response status & request details to beforeRedirect #198
feat: pass response status & request details to beforeRedirect #198
Conversation
This commit adds the originally requested URL and the redirect response’s HTTP status code to the response details passed to `beforeRedirect`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good idea but let's attach a third request
parameter to the beforeRedirect
callback.
Yes, I did PR, but still have no time to add tests |
@SergeBabich No problem. This PR should add the extra field you wanted once merged! |
You rock! |
Do we really need the request headers? |
f63ebbc
to
9771127
Compare
9771127
to
0f0e5d6
Compare
@RubenVerborgh I would find the request headers useful for our purposes (recording requests with axios-har-tracker). Would you be happy with just using |
Ah shoot I just merged at the exact same time as your comment! |
@davecardwell Thanks for your work, I'll take up the headers stuff. |
@RubenVerborgh Thank you very much for helping get this across the line! It’s going to be a big help to us! |
@davecardwell Even |
Done in 96a3947. |
@RubenVerborgh Awesome, thanks again! |
I have a couple of use cases† that require the
beforeRedirect
hook to be aware of the requested URL that is resulting in the redirect. I also noted that in #191 @SergeBabich wanted to add the redirect status code, but hadn’t provided tests.This PR adds both these to the response details object passed to
beforeRedirect
.Update (1aa5e3c) - I also include the request method.
Update (9771127) - Moved URL and method to a third “request details” param
Update (f63ebbc) - Added the request headers to the third param
† I need to store cookies returned across a chain of redirects, as well as to record some forensics about each individual request/response in the chain.