Skip to content

Commit 28d8614

Browse files
authored
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 <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 44fdf95 commit 28d8614

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
@@ -393,7 +393,7 @@ agent. Do not modify.
393393
added: v0.1.17
394394
-->
395395

396-
* Extends: {Stream}
396+
* Extends: {http.OutgoingMessage}
397397

398398
This object is created internally and returned from [`http.request()`][]. It
399399
represents an _in-progress_ request whose header has already been queued. The
@@ -2221,7 +2221,7 @@ Key-value pairs of header names and values. Header names are lower-cased.
22212221
// { 'user-agent': 'curl/7.22.0',
22222222
// host: '127.0.0.1:8000',
22232223
// accept: '*/*' }
2224-
console.log(request.headers);
2224+
console.log(request.getHeaders());
22252225
```
22262226

22272227
Duplicates in raw headers are handled in the following ways, depending on the
@@ -2388,15 +2388,15 @@ Accept: text/plain
23882388
To parse the URL into its parts:
23892389

23902390
```js
2391-
new URL(request.url, `http://${request.headers.host}`);
2391+
new URL(request.url, `http://${request.getHeaders().host}`);
23922392
```
23932393

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

23972397
```console
23982398
$ node
2399-
> new URL(request.url, `http://${request.headers.host}`)
2399+
> new URL(request.url, `http://${request.getHeaders().host}`)
24002400
URL {
24012401
href: 'http://localhost:3000/status?name=ryan',
24022402
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)