Open dahlia opened 5 months ago
1.1.6
Darwin 23.4.0 arm64 arm
// redirect.ts async function main() { const request = new Request("https://w3id.org/security/v1", { redirect: "manual", }); const response = await fetch(request); console.log(response.url); } main();
[!NOTE] The URL https://w3id.org/security/v1 is just an example I found. It redirects to https://w3c-ccg.github.io/security-vocab/contexts/security-v1.jsonld.
$ node redirect.ts https://w3id.org/security/v1 $ deno run --allow-net redirect.ts https://w3id.org/security/v1
$ bun redirect.ts https://w3c-ccg.github.io/security-vocab/contexts/security-v1.jsonld
When you directly specify redirect: "manual" to fetch() (instead of a Request object), it apparently works correctly:
redirect: "manual"
fetch()
Request
// redirect2.ts async function main() { const response = await fetch("https://w3id.org/security/v1", { redirect: "manual", }); console.log(response.url); } main();
$ bun redirect2.ts https://w3id.org/security/v1
Confirming this is a bug
What version of Bun is running?
1.1.6
What platform is your computer?
Darwin 23.4.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
What do you see instead?
Additional information
When you directly specify
redirect: "manual"
tofetch()
(instead of aRequest
object), it apparently works correctly: