Skip to content
Browse files
doc: fix errors in
Fixes: #44567
PR-URL: #44587
Reviewed-By: Rich Trott <>
Reviewed-By: Colin Ihrig <>
Reviewed-By: Trivikram Kamat <>
Reviewed-By: Paolo Insogna <>
Reviewed-By: Mestery <>
  • Loading branch information
lpinca authored and RafaelGSS committed Sep 26, 2022
1 parent 48d944b commit 6c557346a7cb590767ae00d19c32812180a1137d
Showing 1 changed file with 7 additions and 7 deletions.
@@ -889,7 +889,7 @@ header-related http module methods. The keys of the returned object are the
header names and the values are the respective header values. All header names
are lowercase.

The object returned by the `response.getHeaders()` method _does not_
The object returned by the `request.getHeaders()` method _does not_
prototypically inherit from the JavaScript `Object`. This means that typical
`Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, and others
are not defined and _will not work_.
@@ -898,7 +898,7 @@ are not defined and _will not work_.
request.setHeader('Foo', 'bar');
request.setHeader('Cookie', ['foo=bar', 'bar=baz']);
const headers = response.getHeaders();
const headers = request.getHeaders();
// headers === { foo: 'bar', 'cookie': ['foo=bar', 'bar=baz'] }

@@ -2367,7 +2367,7 @@ Key-value pairs of header names and values. Header names are lower-cased.
// { 'user-agent': 'curl/7.22.0',
// host: '',
// accept: '*/*' }

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

new URL(request.url, `http://${request.getHeaders().host}`);
new URL(request.url, `http://${}`);

When `request.url` is `'/status?name=ryan'` and
`request.getHeaders().host` is `'localhost:3000'`:
When `request.url` is `'/status?name=ryan'` and `` is

$ node
> new URL(request.url, `http://${request.getHeaders().host}`)
> new URL(request.url, `http://${}`)
href: 'http://localhost:3000/status?name=ryan',
origin: 'http://localhost:3000',

0 comments on commit 6c55734

Please sign in to comment.