express
express copied to clipboard
fix: throw TypeError for invalid url in res.redirect
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