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
Copy link
Member

@bjohansebas bjohansebas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, but we already have another PR (#6404) ready for this change, which will be released for Express v6. It's not necessary to add tests for a deprecation

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

2 participants