Skip to content

fix: throw TypeError when url is undefined in res.redirect()#7062

Closed
fuleinist wants to merge 1 commit intoexpressjs:masterfrom
fuleinist:fix/redirect-undefined-validation
Closed

fix: throw TypeError when url is undefined in res.redirect()#7062
fuleinist wants to merge 1 commit intoexpressjs:masterfrom
fuleinist:fix/redirect-undefined-validation

Conversation

@fuleinist
Copy link

Previously, res.redirect(undefined) would send an invalid 'Location: undefined' header which is malformed. This fix adds validation to throw a clear TypeError when the url argument is undefined, rather than sending an invalid header.

Fixes #6941

Previously, res.redirect(undefined) would send an invalid 'Location: undefined'
header which is malformed. This fix adds validation to throw a clear TypeError
when the url argument is undefined, rather than sending an invalid header.

Fixes expressjs#6941
@krzysdz
Copy link
Contributor

krzysdz commented Feb 24, 2026

Duplicate of #6404

@krzysdz krzysdz marked this as a duplicate of #6404 Feb 24, 2026
@krzysdz krzysdz closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants