Closed ricordisamoa closed 3 weeks ago
Maybe just deprecate it for now? Koa v2 is pretty far into its final stages.
"only aims to save keystrokes" isn't that what programming is? Every line of code is aimed at hiding some logic to save writing it later. I'm not against removing it since it is kind of magical, but it wouldn't be too hard to say that about most getters/setters/functions/*.
I don't like it because I often use redirections like ctx.redirect('edit')
if the user is at /example-page/view
. I could easily see ctx.redirect('back')
causing a lot of confusion.
For every keystroke saved by the 'magical' case, another keystroke is wasted debugging the inconsistency :wink: but what I really care about is that the issue gets settled once and for all, one way or the other.
if anything, I would prefer this to be a symbol. const BACK = koa.BACK
where BACK = Symbol('BACK')
Since Symbol('BACK') !== 'BACK
', it is a BC break anyway, right?
How about redirectBack()
?
https://github.com/koajs/koa/blob/18dbf5f59c9f3e487e2b49c6dac483d1bed88974/lib/response.js#L254
expressjs/express#2692 is stuck. I thought, Koa is the future, so you may be more open to breaking changes. Sorry if I'm wrong.