-
-
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 coerce header value to string on set
#1394
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1394 +/- ##
==========================================
- Coverage 99.38% 99.38% -0.01%
==========================================
Files 4 4
Lines 485 484 -1
Branches 132 130 -2
==========================================
- Hits 482 481 -1
Partials 3 3
Continue to review full report at Codecov.
|
This change is reasonable but may contains breaking change, I'd like to merge it when we start next major version's development. |
@dead-horse remember that in current implementation you have two more documented ways to set a response header: ctx.res.setHeader('Content-Length', 256);
ctx.response.header['content-length'] = 256; I've linked above that official documentation clearly states that |
The current major has been out and in use long enough that at this point the bug is in the documentation for it. Seems reasonable to adjust it in next major as @dead-horse said. |
good idea. |
Official Koa documentation about
response.set
says This delegates to setHeader which sets or updates headers, butsetHeader
doesn't convert header value types until sending them to the network. This PR fixes behavior ofresponse.set
to be according to the documentation.Also removes recursion on
.set
calling.setHeader
directly, for performance reason.