-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: increase coverage of _http_outgoing #10820
test: increase coverage of _http_outgoing #10820
Conversation
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.
Very close. Almost there.
@@ -12,3 +12,63 @@ assert.strictEqual( | |||
typeof ClientRequest.prototype._implicitHeader, 'function'); | |||
assert.strictEqual( | |||
typeof ServerResponse.prototype._implicitHeader, 'function'); | |||
|
|||
// validateHeader | |||
assert.throws(common.mustCall(() => { |
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 need to use common.mustCall()
on functions passed to assert.throws()
}), /^TypeError: Header name must be a valid HTTP Token \["undefined"\]$/); | ||
|
||
assert.throws(common.mustCall(() => { | ||
const outgoingMessage = new OutgoingMessage(); |
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.
To make the test more efficient, why not create a single top level outgoingMessage
instance, each of the tests can just reuse it
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.
I'm not sure that's a good idea in this case, as the tests would be sharing state unnecessarily.
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.
I agree with @cjihrig's idea.
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.
LGTM once the common.mustCall()
s are dropped.
b04af19
to
d4aaade
Compare
Deleted |
Landed in 02ccffb. Thank you! |
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376 write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477 addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557 PR-URL: #10820 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376 write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477 addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557 PR-URL: nodejs#10820 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376 write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477 addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557 PR-URL: nodejs#10820 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376 write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477 addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557 PR-URL: nodejs#10820 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376 write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477 addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557 PR-URL: nodejs#10820 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport |
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376
write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477
addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test