-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Adding support for beforeRedirect config option #3852
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
Changes from all commits
47fd503
370235a
8409bbf
9440ef6
7eeffd2
14be787
80294f8
02d1f51
ca95553
c03188e
bd8615e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,6 +227,9 @@ module.exports = function httpAdapter(config) { | |
| if (config.maxRedirects) { | ||
| options.maxRedirects = config.maxRedirects; | ||
| } | ||
| if (config.beforeRedirect) { | ||
| options.beforeRedirect = config.beforeRedirect; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this break proxy support when redirection occurs? The setProxy function, which is called before hitting this line, sets Either there should be something to harmonize the two features (such as registering a function that invokes both the original config beforeRedirect if needed, and the proxy re-configuration next) or the documentation should state that the |
||
| } | ||
| transport = isHttpsProxy ? httpsFollow : httpFollow; | ||
| } | ||
|
|
||
|
|
@@ -326,7 +329,7 @@ module.exports = function httpAdapter(config) { | |
|
|
||
| // Handle errors | ||
| req.on('error', function handleRequestError(err) { | ||
| if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return; | ||
| if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') reject(err); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without this request will never complete.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just to expand more on this change, I haven't used |
||
| reject(enhanceError(err, config, null, req)); | ||
| }); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.