Skip to content

Conversation

@BOXER78
Copy link

@BOXER78 BOXER78 commented Dec 3, 2025

Calling res.redirect(undefined) currently sends a 302 response with Location: undefined,
resulting in an invalid redirect header.

This PR throws a TypeError when the URL argument is missing, consistent with the deprecation
warning ("Provide a url argument") and prevents malformed headers.

Improved the redirect tests to match Express behavior more accurately:

  • correct expected error message
  • unified jsonError handler
  • stronger Location header assertion
  • stack presence check

The updated test suite does not change redirect behavior, but validates it more accurately and prevents future regressions.
Fixes #6941

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