Closed dead-horse closed 5 years ago
I just saw your reference @dead-horse. From my point of view, respond.false is very useful and sometimes neccessary in specific implementations. I would go for logging a warning in develop (or via debug) module mode but still allow and fix the behaviour. Maybe add some more info what side effects respond false has ?
And yes, I see that this should actually live in koa and not in koa-session, I will close my PR in order to find a solution here
this is already fixed in https://github.com/koajs/koa/pull/1137
many people using
next.js
or migrate there app from express will setrespond=false
, but lots of koa's middleware will set header like:it will cause
Can't set headers after they are sent
error if we already sent response body before. Maybe we can makectx.set()
invalid whenrespond=false
and header sent. (We can log something when NODE_ENV is develop to hint developer this unexpected behavior)related issues:
Any thoughts?