-
-
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 access res._headers directly when helpers exist #907
Conversation
lib/context.js
Outdated
@@ -116,7 +116,12 @@ var proto = module.exports = { | |||
} | |||
|
|||
// unset all headers, and set those specified | |||
this.res._headers = {}; | |||
if (this.res.getHeaderNames) { | |||
this.res.getHeaderNames().forEach(function(name) { this.removeHeader(name) }, this.res); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line gets tested when the tests a are run with node 8 (test/context/onerror.js). I did a manual test run using node master branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no removeAllHeaders()
, hence the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then again coverage was 100%, it can't drop. Added a test.
990ddc4
to
368038d
Compare
Codecov Report
@@ Coverage Diff @@
## master #907 +/- ##
==========================================
- Coverage 100% 99.76% -0.24%
==========================================
Files 4 4
Lines 420 424 +4
Branches 102 104 +2
==========================================
+ Hits 420 423 +3
- Misses 0 1 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #907 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 4 4
Lines 420 424 +4
Branches 102 104 +2
=====================================
+ Hits 420 424 +4
Continue to review full report at Codecov.
|
res._headers is considered internal to node itself. Its value will change in a backwards incompatible way in the future node releases. Use the documented helper functions instead when they are available.
368038d
to
c2550c2
Compare
c2550c2
to
1e5a861
Compare
I want to merge this, but I want to test against node nightly. anyone know if there's an easy way to test against node nightly on travis? |
@dougwilson you are the best |
Node HTTP module
response._headers
is considered internal to node itself. Its value willchange in a backwards incompatible way in the future node releases.
Use the documented accessor functions instead when they are available.