Skip to content

Commit 0c9343c

Browse files
kcak11danielleadams
authored andcommitted
http: document that ClientRequest inherits from OutgoingMessage
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file PR-URL: #42642 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent dc4b66c commit 0c9343c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

doc/api/http.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ agent. Do not modify.
391391
added: v0.1.17
392392
-->
393393

394-
* Extends: {Stream}
394+
* Extends: {http.OutgoingMessage}
395395

396396
This object is created internally and returned from [`http.request()`][]. It
397397
represents an _in-progress_ request whose header has already been queued. The
@@ -2209,7 +2209,7 @@ Key-value pairs of header names and values. Header names are lower-cased.
22092209
// { 'user-agent': 'curl/7.22.0',
22102210
// host: '127.0.0.1:8000',
22112211
// accept: '*/*' }
2212-
console.log(request.headers);
2212+
console.log(request.getHeaders());
22132213
```
22142214

22152215
Duplicates in raw headers are handled in the following ways, depending on the
@@ -2376,15 +2376,15 @@ Accept: text/plain
23762376
To parse the URL into its parts:
23772377

23782378
```js
2379-
new URL(request.url, `http://${request.headers.host}`);
2379+
new URL(request.url, `http://${request.getHeaders().host}`);
23802380
```
23812381

23822382
When `request.url` is `'/status?name=ryan'` and
2383-
`request.headers.host` is `'localhost:3000'`:
2383+
`request.getHeaders().host` is `'localhost:3000'`:
23842384

23852385
```console
23862386
$ node
2387-
> new URL(request.url, `http://${request.headers.host}`)
2387+
> new URL(request.url, `http://${request.getHeaders().host}`)
23882388
URL {
23892389
href: 'http://localhost:3000/status?name=ryan',
23902390
origin: 'http://localhost:3000',

tools/doc/type-parser.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ const customTypesMap = {
148148
'http.Agent': 'http.html#class-httpagent',
149149
'http.ClientRequest': 'http.html#class-httpclientrequest',
150150
'http.IncomingMessage': 'http.html#class-httpincomingmessage',
151+
'http.OutgoingMessage': 'http.html#class-httpoutgoingmessage',
151152
'http.Server': 'http.html#class-httpserver',
152153
'http.ServerResponse': 'http.html#class-httpserverresponse',
153154

0 commit comments

Comments
 (0)