-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
don't set header when respond=false
and header sent
#1044
Comments
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 #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:
Error: Can’t set headers after they are sent
session#89Any thoughts?
The text was updated successfully, but these errors were encountered: