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

Headers no longer available at beforeRedirect #5176

Closed
yli-hallila opened this issue Oct 24, 2022 · 1 comment
Closed

Headers no longer available at beforeRedirect #5176

yli-hallila opened this issue Oct 24, 2022 · 1 comment

Comments

@yli-hallila
Copy link

yli-hallila commented Oct 24, 2022

Describe the bug

Prior to PR #4708 you could access redirect headers with beforeRedirect: (options, { headers }) but with the changes in #4708 the headers are no longer available. To me it's unclear whether this was an intentional change or not but the documentation suggests that this should still be working.

To Reproduce

https://npm.runkit.com/axios

var axios = require("axios")
// Works with an older version
// var axios = require("axios@0.27.2")
var express = require("express")
var app = express()

app.get('/redirect', (req, res) => {
  res.cookie("Hello", "World");
  res.redirect("/");
})

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(3000, () => {
    axios.get("http://localhost:3000/redirect", {
        // Headers undefined
        beforeRedirect: (options, { headers }) => {
            console.log({options, headers});
        }
    });
});
@jasonsaayman
Copy link
Member

Hi 👋

Please try the latest pre-release by running the following:

npm i axios@1.2.0-alpha.1

Please provide feedback in either the pinned issue or the discussion thread 🧵

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

No branches or pull requests

2 participants