Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
test: improve http-client coverage#33633
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
| assert.throws(() =>{ | ||
| new ClientRequest({insecureHTTPParser: 'wrongValue'}); | ||
| },{ | ||
| code: /ERR_INVALID_ARG_TYPE/ |
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.
| code: /ERR_INVALID_ARG_TYPE/ | |
| code: 'ERR_INVALID_ARG_TYPE', | |
| message: /insecureHTTPParser/ |
| const ClientRequest = require('http').ClientRequest; | ||
| { | ||
| const req = new ClientRequest(() =>{}); |
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.
The test should definitely hit the mentioned code line but it would be great to write a test that actually verifies that the callback is also called and ideally, this test case would not cause any errors, since it's a legit code path.
KuthorXMay 30, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
@BridgeAR Here is a rewrote version, which can make cb be called, but it's a little longer than previous version, so I am not sure whether it's ok, could you help me to check?
'use strict';constcommon=require('../common');consthttp=require('http');constassert=require('assert');constClientRequest=require('http').ClientRequest;{constserver=http.createServer(common.mustCall((req,res)=>{res.writeHead(200);res.end('hello world');})).listen(80,'127.0.0.1');constreq=newClientRequest(common.mustCall((response)=>{letbody='';response.setEncoding('utf8');response.on('data',(chunk)=>{body+=chunk;});response.on('end',common.mustCall(()=>{assert.strictEqual(body,'hello world');server.close();}));}));req.end();}BridgeAR commented May 30, 2020
@KuthorX thank you very much for your contribution! This is already looking pretty good, just left two minor comments. |
8ae28ff to 2935f72CompareKuthorX commented Sep 4, 2020
Could someone help me to review lastest commit? Any suggestion will be appreciated. |
nodejs-github-bot commented Dec 24, 2020
af3315a to d64869dCompareaduh95 commented Sep 19, 2023
Ping @nodejs/http for reviews. |
d64869d to 289444eCompareShogunPanda commented Oct 6, 2023
The changes look fine to me. There is only one test failing as you're using port 80. Can you use another port? |
KuthorX commented Oct 9, 2023
thanks, has changed to 8080 |
Uh oh!
There was an error while loading. Please reload this page.
ShogunPanda left a comment
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!
nodejs-github-bot commented Oct 10, 2023
KuthorX commented Oct 11, 2023
looks like some ci fail, maybe I should merge main branch? @ShogunPanda |
mcollina left a comment
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
nodejs-github-bot commented Oct 11, 2023
nodejs-github-bot commented Oct 29, 2023
nodejs-github-bot commented Oct 30, 2023
nodejs-github-bot commented Dec 4, 2023
nodejs-github-bot commented Dec 18, 2023
nodejs-github-bot commented Dec 19, 2023
nodejs-github-bot commented Dec 19, 2023
Landed in c925039 |
PR-URL: nodejs#33633 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]>
KuthorX commented Dec 19, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
After 3 years, it merged, thank you guys 😌 |
PR-URL: #33633 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #33633 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]>
Based on https://coverage.nodejs.org/coverage-d12d5ef3ef8e5d9f/lib/_http_client.js.html, I try to improve coverage to line 120 (http-client-input-function), 194-197 (http-client-insecure-http-parser-error)
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes