Skip to content

Conversation

@theaniketgiri
Copy link

Fixes #6941

Previously, res.redirect(undefined) would send an invalid Location: undefined header. This change throws a TypeError when the url argument is undefined or not a string, aligning with the behavior of other Express methods like res.sendFile.

Changes:

  • Throw TypeError when url is undefined
  • Throw TypeError when url is not a string
  • Add comprehensive tests for invalid url handling

Fixes expressjs#6941

Previously, res.redirect(undefined) would send an invalid
Location: undefined header. This change throws a TypeError
when the url argument is undefined or not a string, aligning
with the behavior of other Express methods like res.sendFile.

Changes:
- Throw TypeError when url is undefined
- Throw TypeError when url is not a string
- Add comprehensive tests for invalid url handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant