-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Axios request fails when setting maxRedirects to 0 #4871
Comments
@JeremyFunk this runs on [email protected] |
This issue can be reproduced in 1.0.3. I see that when The following code will hang in bun import axios from "axios";
import http from "node:http";
const resp = await axios.get("http://example.com", { transport: http });
console.log(resp.data); Env
Update: After some debugging, I found import http from "node:http";
const req = http.request("http://example.com", (res) => {
console.log("req.destroyed", req.destroyed);
res.on("data", (data) => {
// console.log(`Received response: ${data}`);
});
res.on("end", () => {
// console.log("Request finished.");
});
});
req.end(); |
does this still reproduce for you? it appears to be working on my end in Bun 1.1.10 (you may need to run many axios fixes made it into Bun 1.1.8# and Bun 1.1.9#. |
sweet, axios and this test case as well work now! |
What version of Bun is running?
1.0.0
What platform is your computer?
Darwin 22.4.0 arm64 arm
What steps can reproduce the bug?
Execute this code:
bun index.ts
node.index.ts
Then, change maxRedirects to 1 and repeat.
What is the expected behavior?
NodeJS and Bun should behave the same way. That is, if maxRedirects is set to 0, the request should not silently stall.
What do you see instead?
Bun and Node are behaving the same way when running with
maxRedirects >=1
. AtmaxRedirects = 0
NodeJS can execute the code with no issue while Bun silently stalls (infinitely waits for the promise to be resolved).Additional information
I tested with multiple axios versions. The snippet above was written with version 1.5.0
The text was updated successfully, but these errors were encountered: