From b7e2e879e023a8aca15dabb6c2a613108036d1b4 Mon Sep 17 00:00:00 2001 From: "K.C.Ashish Kumar" <703559+kcak11@users.noreply.github.com> Date: Thu, 7 Apr 2022 15:35:17 +0530 Subject: [PATCH 1/6] http: replaced request.headers with request.getHeaders() --- doc/api/http.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index dd8c90d79a34042..de8a6fa8ed8e6f4 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -2221,7 +2221,7 @@ Key-value pairs of header names and values. Header names are lower-cased. // { 'user-agent': 'curl/7.22.0', // host: '127.0.0.1:8000', // accept: '*/*' } -console.log(request.headers); +console.log(request.getHeaders()); ``` Duplicates in raw headers are handled in the following ways, depending on the @@ -2388,15 +2388,15 @@ Accept: text/plain To parse the URL into its parts: ```js -new URL(request.url, `http://${request.headers.host}`); +new URL(request.url, `http://${request.getHeaders().host}`); ``` When `request.url` is `'/status?name=ryan'` and -`request.headers.host` is `'localhost:3000'`: +`request.getHeaders().host` is `'localhost:3000'`: ```console $ node -> new URL(request.url, `http://${request.headers.host}`) +> new URL(request.url, `http://${request.getHeaders().host}`) URL { href: 'http://localhost:3000/status?name=ryan', origin: 'http://localhost:3000', From f636bf8976e1475e783a680277f215e59110b79b Mon Sep 17 00:00:00 2001 From: "K.C.Ashish Kumar" <703559+kcak11@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:06:22 +0530 Subject: [PATCH 2/6] http: fix extends for ClientRequest from Stream to http.OutgoingMessage --- 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 de8a6fa8ed8e6f4..86234e2fef8b660 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -393,7 +393,7 @@ agent. Do not modify. added: v0.1.17 --> -* Extends: {Stream} +* Extends: {http.OutgoingMessage} This object is created internally and returned from [`http.request()`][]. It represents an _in-progress_ request whose header has already been queued. The From 535d11950228f4441d5d4fdcec628cf2b26db10d Mon Sep 17 00:00:00 2001 From: "K.C.Ashish Kumar" <703559+kcak11@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:23:11 +0530 Subject: [PATCH 3/6] http: added page entry for http.OutgoingMessage --- doc/api/http.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/http.md b/doc/api/http.md index 86234e2fef8b660..9a7a020a4f36a85 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -3427,6 +3427,7 @@ try { [`getHeader(name)`]: #requestgetheadername [`http.Agent`]: #class-httpagent [`http.ClientRequest`]: #class-httpclientrequest +[`http.OutgoingMessage`]: #class-httpoutgoingmessage [`http.IncomingMessage`]: #class-httpincomingmessage [`http.ServerResponse`]: #class-httpserverresponse [`http.Server`]: #class-httpserver From f1276e87c824046d01781117bf96c66c47eb8491 Mon Sep 17 00:00:00 2001 From: "K.C.Ashish Kumar" <703559+kcak11@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:29:37 +0530 Subject: [PATCH 4/6] http: updated order of links --- 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 9a7a020a4f36a85..204b1ff494d7675 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -3427,8 +3427,8 @@ try { [`getHeader(name)`]: #requestgetheadername [`http.Agent`]: #class-httpagent [`http.ClientRequest`]: #class-httpclientrequest -[`http.OutgoingMessage`]: #class-httpoutgoingmessage [`http.IncomingMessage`]: #class-httpincomingmessage +[`http.OutgoingMessage`]: #class-httpoutgoingmessage [`http.ServerResponse`]: #class-httpserverresponse [`http.Server`]: #class-httpserver [`http.get()`]: #httpgetoptions-callback From 8ac3cf1738a72dea0713baae22bb3452421f8c00 Mon Sep 17 00:00:00 2001 From: "K.C.Ashish Kumar" <703559+kcak11@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:34:53 +0530 Subject: [PATCH 5/6] http: included entry for http.OutgoingMessage --- tools/doc/type-parser.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/doc/type-parser.mjs b/tools/doc/type-parser.mjs index 3bdbffdbe0532e4..7d76d072c340332 100644 --- a/tools/doc/type-parser.mjs +++ b/tools/doc/type-parser.mjs @@ -148,6 +148,7 @@ const customTypesMap = { 'http.Agent': 'http.html#class-httpagent', 'http.ClientRequest': 'http.html#class-httpclientrequest', 'http.IncomingMessage': 'http.html#class-httpincomingmessage', + 'http.OutgoingMessage': 'http.html#class-httpoutgoingmessage', 'http.Server': 'http.html#class-httpserver', 'http.ServerResponse': 'http.html#class-httpserverresponse', From e8b09d9e57fc1113a04be13700a1d3ca24dfb660 Mon Sep 17 00:00:00 2001 From: "K.C.Ashish Kumar" <703559+kcak11@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:45:11 +0530 Subject: [PATCH 6/6] http: removed unnecessary entry from md file --- doc/api/http.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/api/http.md b/doc/api/http.md index 204b1ff494d7675..86234e2fef8b660 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -3428,7 +3428,6 @@ try { [`http.Agent`]: #class-httpagent [`http.ClientRequest`]: #class-httpclientrequest [`http.IncomingMessage`]: #class-httpincomingmessage -[`http.OutgoingMessage`]: #class-httpoutgoingmessage [`http.ServerResponse`]: #class-httpserverresponse [`http.Server`]: #class-httpserver [`http.get()`]: #httpgetoptions-callback