-
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: refactor test-http-response-splitting #11429
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.
Almost there
function test(res, code, header) { | ||
assert.throws(() => { | ||
res.writeHead(code, header); | ||
}); |
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 should actually be updated to test the actual error message
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.
thank you! implemented.
e84501e
to
42dbf60
Compare
Thanks for review :-) Recommited with error message checking and with new commit message. |
@@ -19,23 +19,26 @@ const y = 'foo⠊Set-Cookie: foo=bar'; | |||
|
|||
let count = 0; | |||
|
|||
function test(res, code, header) { | |||
const errRegExp = new RegExp( | |||
'TypeError: The header content contains invalid characters' |
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.
Can you add ^
and $
to the regular expression. You can also use a regex literal instead of the RegExp()
constructor.
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.
Yeah, seems better. Thank you for pointing this out! Fixed.
308738e
to
a84c506
Compare
Re-forcepushed again with fixes. Feel free to commenting anything more :) |
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. Only comment is that it might look a little cleaner to drop errRegExp
, and just put the regex inline.
* move repeated code to function * remove unneeded `common.mustCall()` usage with function arguments that are not callbacks * add error message checking
a84c506
to
fc16912
Compare
Why test on armv8-ubuntu1404 is break down? This test is passed, but there's hudson-related issue (unrelated to this PR):
|
Probably related to nodejs/build#611 |
* move repeated code to function * remove unneeded `common.mustCall()` usage with function arguments that are not callbacks * add error message checking PR-URL: #11429 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Landed in 6647688 |
* move repeated code to function * remove unneeded `common.mustCall()` usage with function arguments that are not callbacks * add error message checking PR-URL: #11429 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]>
* move repeated code to function * remove unneeded `common.mustCall()` usage with function arguments that are not callbacks * add error message checking PR-URL: #11429 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]>
* move repeated code to function * remove unneeded `common.mustCall()` usage with function arguments that are not callbacks * add error message checking PR-URL: #11429 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]>
* move repeated code to function * remove unneeded `common.mustCall()` usage with function arguments that are not callbacks * add error message checking PR-URL: #11429 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]>
* move repeated code to function * remove unneeded `common.mustCall()` usage with function arguments that are not callbacks * add error message checking PR-URL: #11429 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]>
common.mustCall()
usage with function arguments thatare not callbacks
like #11274.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test http