Skip to content

fix: missing beforeRedirect requestDetails argument#6241

Merged
jasonsaayman merged 1 commit intoaxios:v1.xfrom
davecardwell:master
Apr 26, 2026
Merged

fix: missing beforeRedirect requestDetails argument#6241
jasonsaayman merged 1 commit intoaxios:v1.xfrom
davecardwell:master

Conversation

@davecardwell
Copy link
Copy Markdown
Contributor

@davecardwell davecardwell commented Feb 19, 2024

When attempting to upgrade from v0.27.2 to v1.67.0 we found that Axios is no longer passing through the third requestDetails argument to the beforeRedirect(…) function.

This contains the request’s original method, URL, and headers prior to the redirect.

This PR adds this argument back in.

Fixes #6442

@davecardwell davecardwell force-pushed the master branch 2 times, most recently from 8c4198d to b8b4296 Compare February 19, 2024 06:46
@davecardwell
Copy link
Copy Markdown
Contributor Author

davecardwell commented Apr 29, 2024

@DigitalBrainJS any chance we could get 👀 on this please? It’s a regression similar to #5778 with a simple fix, and I see @-ing you in that PR helped to get it over the line.

@davecardwell
Copy link
Copy Markdown
Contributor Author

@jasonsaayman any chance I could get 👀 on this PR please? It’s been hanging for a while but is a pretty simple fix for a behavior regression from earlier versions which is holding us back from upgrading.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restores the missing third requestDetails argument to the beforeRedirect callback function, fixing a regression from v0.27.2 to v1.67.0. The requestDetails parameter contains the original request's method, URL, and headers prior to the redirect.

Changes:

  • Updated the dispatchBeforeRedirect function signature to accept and pass through the requestDetails parameter
  • Updated TypeScript definitions to reflect the third parameter
  • Added test coverage to verify the requestDetails argument is properly passed

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
lib/adapters/http.js Updated dispatchBeforeRedirect function to accept and forward the requestDetails parameter to the user's beforeRedirect callback
index.d.ts Added the requestDetails parameter type definition to the beforeRedirect callback signature
index.d.cts Added the requestDetails parameter type definition to the beforeRedirect callback signature (CommonJS)
test/unit/adapters/http.js Enhanced test to verify the requestDetails parameter is properly passed with the original URL

@davecardwell
Copy link
Copy Markdown
Contributor Author

@jasonsaayman I reapplied my changes onto the latest v1.x branch. Please could you take another look?

@jasonsaayman jasonsaayman added priority::medium A medium priority commit::fix The PR is related to a bugfix labels Apr 26, 2026
@jasonsaayman jasonsaayman merged commit caa3497 into axios:v1.x Apr 26, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix priority::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missing beforeRedirect requestDetails argument

3 participants