-
Notifications
You must be signed in to change notification settings - Fork 30.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
http: flush stored header #1695
Conversation
@@ -5,7 +5,7 @@ const http = require('http'); | |||
|
|||
const server = http.createServer(); | |||
server.on('request', function(req, res){ | |||
assert(req.headers['foo'], 'bar'); | |||
assert(req.headers['foo'] === 'bar'); |
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.
Why this change?
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.
just an unrelated fix. bar
was used as a message, not as expected value
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.
Ah I see now. Maybe it would be better to change this to assert.equal()
instead, that way if the assertion should fail, it will show the two non-matching values in the message instead of just "false."
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.
yep, it is better!
4deb05b
to
a486d0c
Compare
|
||
const server = http.createServer(); | ||
|
||
server.on('request', function(req, 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.
sorry, style: space in (req, res) {
a486d0c
to
e416156
Compare
server.on('request', function(req, res) { | ||
res.writeHead(200, {'foo': 'bar'}); | ||
res.flushHeaders(); | ||
res.flushHeaders(); |
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.
what the second flushHeaders()
call is for?
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.
Saw another test doing this. flushHeaders
should be idempotent, this validates that nothing fatal happens if it is called twice
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.
Could you add that as a comment to the second flushHeaders
call?
LGTM with a comment. Is the CI happy? |
CI is happy, @vkurchatkin are you able to update this? |
`flushHeaders` should work for header written with `writeHead`.
e416156
to
01b7a80
Compare
updated! @Fishrock123 can you start CI, it's a shame but I have no idea how do it |
@vkurchatkin https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/723/ Ping me on IRC if you want instructions on how to start a job (assuming you have an account.) |
`flushHeaders` should work for header written with `writeHead`. PR-URL: #1695 Reviewed-By: Ben Noordhuis <[email protected]>
All is green! this is really satisfying :-). Landed in 2c686fd |
`flushHeaders` should work for header written with `writeHead`. PR-URL: nodejs/node#1695 Reviewed-By: Ben Noordhuis <[email protected]>
flushHeaders
should work for header written withwriteHead
.R=@bnoordhuis