-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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-expect-continue #19625
Conversation
Use common.mustCall() where appropriate. Remove some logic that is not required when common.mustCall() is used (incrementor/decrementor to make sure everything is called the same number of times).
console.error('Got full response.'); | ||
assert.strictEqual(body, test_res_body, 'Response body doesn\'t match.'); | ||
assert.strictEqual(body, test_res_body); |
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.
@Trott - is it that the removed error message is too awkward to be of any use, or is there a consensus / guideline to remove error messages from assertion statements?
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.
By including that assertion message, we suppress the printing of the contents of body
and test_res_body
when there is in AssertionError
. Those values would seem to be useful for debugging. In contrast, the supplied message doesn't provide any useful information IMO.
An alternative would be to replace it with a template literal: `Response body doesn't match. Expected ${test_res_body} but received ${body}.`
I prefer simply removing it, but I could go with that if it's deemed important to keep.
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.
thanks for the clarification!
|
||
const server = http.createServer(handler); | ||
server.on('checkContinue', function(req, res) { | ||
const server = http.createServer(); |
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.
handler
is no longer registered as a 'request' listener?
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.
Actually, given the description in the API docs for checkContinue
it probably makes more sense to register a common.mustNotCall
request listener.
Landed in ffe3f9a |
Use common.mustCall() where appropriate. Remove some logic that is not required when common.mustCall() is used (incrementor/decrementor to make sure everything is called the same number of times). PR-URL: nodejs#19625 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use common.mustCall() where appropriate. Remove some logic that is not required when common.mustCall() is used (incrementor/decrementor to make sure everything is called the same number of times). PR-URL: #19625 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use common.mustCall() where appropriate. Remove some logic that is not required when common.mustCall() is used (incrementor/decrementor to make sure everything is called the same number of times). PR-URL: #19625 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use common.mustCall() where appropriate. Remove some logic that is not
required when common.mustCall() is used (incrementor/decrementor to make
sure everything is called the same number of times).
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes