express icon indicating copy to clipboard operation
express copied to clipboard

fix: throw TypeError for invalid url in res.redirect

Open theaniketgiri opened this issue 1 month ago • 0 comments

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

theaniketgiri avatar Dec 03 '25 17:12 theaniketgiri