Skip to content
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

http: document that ClientRequest inherits from OutgoingMessage #42642

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions tools/doc/type-parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down