Skip to content

fix(response): throw TypeError on invalid redirect url/status - #7323

Closed
Dasmat13 wants to merge 1 commit into
expressjs:masterfrom
Dasmat13:fix/redirect-undefined-url
Closed

fix(response): throw TypeError on invalid redirect url/status#7323
Dasmat13 wants to merge 1 commit into
expressjs:masterfrom
Dasmat13:fix/redirect-undefined-url

Conversation

@Dasmat13

Copy link
Copy Markdown

Fixes#6941. When res.redirect(undefined) is called, it previously logged a deprecation warning and then proceeded to send an invalid Location: undefined header. This commit changes the behavior to throw a TypeError immediately if the url is undefined, null, or not a string. It also throws a TypeError if the status is not a number. Tests have been added to verify this behavior.

Fixesexpressjs#6941
Signed-off-by: Dasmat13 <mey37056@gmail.com>
@krzysdz

Copy link
Copy Markdown
Contributor

Duplicate of#6404

@krzysdzkrzysdz marked this as a duplicate of #6404Jun 20, 2026
@krzysdzkrzysdz closed this Jun 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

res.redirect(undefined) sends invalid Location: undefined header

2 participants

@Dasmat13@krzysdz