From 4dc7ac6a4589e022f944b539484a5bd7ac2be5e6 Mon Sep 17 00:00:00 2001 From: wenningplus Date: Tue, 9 Jun 2020 13:42:07 +0800 Subject: [PATCH 1/7] =?UTF-8?q?http:ClientRequest=20return=20host=E3=80=81?= =?UTF-8?q?protocol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/api/http.md | 21 ++++++++++++++++ lib/_http_client.js | 2 ++ .../parallel/test-http-outgoing-properties.js | 25 +++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/doc/api/http.md b/doc/api/http.md index 8d858ba8248334..d14bdbdae2a3ba 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -744,6 +744,27 @@ added: v0.4.0 * {string} The request path. +### `request.method` + + +* {string} The request method. + +### `request.host` + + +* {string} The request host. + +### `request.protocol` + + +* {string} The request protocol. + ### `request.removeHeader(name)` * {string} The request method. ### `request.host` * {string} The request host. ### `request.protocol` * {string} The request protocol. From ce83a1a287ed683eea3b2971a08f48c6739dfefb Mon Sep 17 00:00:00 2001 From: wenningplus Date: Tue, 9 Jun 2020 23:45:50 +0800 Subject: [PATCH 3/7] update doc format and modify test unit --- doc/api/http.md | 6 +----- test/parallel/test-http-outgoing-properties.js | 8 +++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index 39cc40288f416b..7b337bb4611ed8 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -746,11 +746,7 @@ added: v0.4.0 ### `request.method` * {string} The request method. diff --git a/test/parallel/test-http-outgoing-properties.js b/test/parallel/test-http-outgoing-properties.js index 2a29a288d925c9..17348090aa41cd 100644 --- a/test/parallel/test-http-outgoing-properties.js +++ b/test/parallel/test-http-outgoing-properties.js @@ -55,14 +55,12 @@ const OutgoingMessage = http.OutgoingMessage; { const server = http.createServer(function(req, res) { res.end(); - res.on('finish', () => { - server.close(); - }); + server.close(); }); server.listen(0); - server.on('listening', function() { + server.on('listening', common.mustCall(function() { const req = http.request({ port: server.address().port, method: 'GET', @@ -74,5 +72,5 @@ const OutgoingMessage = http.OutgoingMessage; assert.strictEqual(req.host, 'localhost'); assert.strictEqual(req.protocol, 'http:'); req.end(); - }); + })); } From 52500aef703d8e5d1c582673fedb350e461d1e0b Mon Sep 17 00:00:00 2001 From: wenningplus Date: Wed, 10 Jun 2020 07:56:38 +0800 Subject: [PATCH 4/7] modify request.method version --- doc/api/http.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/http.md b/doc/api/http.md index 7b337bb4611ed8..aeaf834ee06313 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -746,7 +746,7 @@ added: v0.4.0 ### `request.method` * {string} The request method. From df6fcfea2237d4ce6a40fc1e11d73708ebd81365 Mon Sep 17 00:00:00 2001 From: wenningplus Date: Wed, 10 Jun 2020 11:04:13 +0800 Subject: [PATCH 5/7] remote changes section --- doc/api/http.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index aeaf834ee06313..d4987e13494471 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -754,10 +754,6 @@ added: v0.1.97 ### `request.host` * {string} The request host. @@ -765,10 +761,6 @@ changes: ### `request.protocol` * {string} The request protocol. From 62cc2aff1790164d3d194186d4c9c0e94ed17b9c Mon Sep 17 00:00:00 2001 From: zhangwinning Date: Mon, 22 Jun 2020 08:51:00 +0800 Subject: [PATCH 6/7] Update test/parallel/test-http-outgoing-properties.js Co-authored-by: mscdex --- test/parallel/test-http-outgoing-properties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-outgoing-properties.js b/test/parallel/test-http-outgoing-properties.js index 17348090aa41cd..1019c736ccc975 100644 --- a/test/parallel/test-http-outgoing-properties.js +++ b/test/parallel/test-http-outgoing-properties.js @@ -53,7 +53,7 @@ const OutgoingMessage = http.OutgoingMessage; } { - const server = http.createServer(function(req, res) { + const server = http.createServer((req, res) => { res.end(); server.close(); }); From be3c4b1579c2a3cb6fa41d5533785221c3a46f7b Mon Sep 17 00:00:00 2001 From: zhangwinning Date: Mon, 22 Jun 2020 08:51:24 +0800 Subject: [PATCH 7/7] Update test/parallel/test-http-outgoing-properties.js Co-authored-by: mscdex --- test/parallel/test-http-outgoing-properties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-outgoing-properties.js b/test/parallel/test-http-outgoing-properties.js index 1019c736ccc975..ec25546c4b66ec 100644 --- a/test/parallel/test-http-outgoing-properties.js +++ b/test/parallel/test-http-outgoing-properties.js @@ -60,7 +60,7 @@ const OutgoingMessage = http.OutgoingMessage; server.listen(0); - server.on('listening', common.mustCall(function() { + server.on('listening', common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'GET',