Skip to content

Commit

Permalink
fix(node-fetch): Response.redirect\'s status code should be 302 b…
Browse files Browse the repository at this point in the history
…y default
  • Loading branch information
ardatan committed Aug 5, 2024
1 parent 2a02b49 commit 4df7cdf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/loud-donuts-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@whatwg-node/node-fetch': patch
---

\`Response.redirect\`'s default status code is \`302\`
2 changes: 1 addition & 1 deletion packages/node-fetch/src/Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class PonyfillResponse<TJSON = any> extends PonyfillBody<TJSON> implement
});
}

static redirect(url: string, status = 301) {
static redirect(url: string, status = 302) {
if (status < 300 || status > 399) {
throw new RangeError('Invalid status code');
}
Expand Down

0 comments on commit 4df7cdf

Please sign in to comment.