express
express copied to clipboard
Cleaner way for redirecting back to the Referrer
The 'back' special case has been moved from res.location()
to a new req.back
getter. In the future, this will make it possible to redirect to a regular 'back' page.
As this is a breaking change, though small, I wouldn't mind issuing a deprecation warning and waiting for 5.x instead.
Seems reasonable to me to remove the magic string value in 5.0
Changed to emit deprecate()
instead of breaking the current behavior.
Any update?
How is this any different than just res.redirect(req.get("referer")||"/")
?
The 'back'
should just be removed as it is a feature that only aims to save keystrokes.
Sidenote: If we are to keep this I suggest adding a test or two for res.location
separate from res.redirect
.
@dougwilson what should I do?
I'm all for removing the magic string from Express 5.0, but yes, adding req.back is not a good replacement either, so what to replace it with needs to be thought on more.