You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it will cause Can't set headers after they are sent error if we already sent response body before. Maybe we can make ctx.set() invalid when respond=false and header sent. (We can log something when NODE_ENV is develop to hint developer this unexpected behavior)
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 ?
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:
Error: Can’t set headers after they are sent
session#89Any thoughts?
The text was updated successfully, but these errors were encountered: