Description
I think it would make sense to throw an error when the path is undefined in res.redirect. The current behavior redirects to /undefined, which I wouldn't consider very intuitive.
This functionality would be a breaking change, so it could be a candidate for Express 6. What do you all think?
Activity
banskotanup commentedon Mar 16, 2025
I think throwing an error will be great whenever path is undefined in res.redirect.
baltej223 commentedon Mar 16, 2025
Yep, it's pretty intuitive to throw an error rather than redirect to /undefined
dpopp07 commentedon Mar 17, 2025
Agreed - that sounds like the kind of sneaky, unexpected behavior that is hard to debug. The path is also documented as required so an error would make sense (as a side note, I find it odd that the optional argument comes first for this method - that's not a great practice and most of the other methods don't do that).
bjohansebas commentedon Mar 17, 2025
Interesting that this was deprecated in v4 and removed in v5 (See #2941), it probably should never have been that way. I also find it just as strange that the optional argument is the first one.
wesleytodd commentedon Apr 11, 2025
Agreed on all of this. Let's keep that 6.x label on here, and when we start the branch we can open a PR for it.
wesleytodd commentedon Apr 11, 2025
Oh! Ha, already done just no branch to make it against. We can close this then and just re-target that when we are ready.