@@ -889,7 +889,7 @@ header-related http module methods. The keys of the returned object are the
889889header names and the values are the respective header values. All header names
890890are lowercase.
891891
892- The object returned by the ` response .getHeaders()` method _ does not_
892+ The object returned by the ` request .getHeaders()` method _ does not_
893893prototypically inherit from the JavaScript ` Object ` . This means that typical
894894` Object ` methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` , and others
895895are not defined and _ will not work_ .
@@ -898,7 +898,7 @@ are not defined and _will not work_.
898898request .setHeader (' Foo' , ' bar' );
899899request .setHeader (' Cookie' , [' foo=bar' , ' bar=baz' ]);
900900
901- const headers = response .getHeaders ();
901+ const headers = request .getHeaders ();
902902// headers === { foo: 'bar', 'cookie': ['foo=bar', 'bar=baz'] }
903903```
904904
@@ -2367,7 +2367,7 @@ Key-value pairs of header names and values. Header names are lower-cased.
23672367// { 'user-agent': 'curl/7.22.0',
23682368// host: '127.0.0.1:8000',
23692369// accept: '*/*' }
2370- console .log (request .getHeaders () );
2370+ console .log (request .headers );
23712371```
23722372
23732373Duplicates in raw headers are handled in the following ways, depending on the
@@ -2566,15 +2566,15 @@ Accept: text/plain
25662566To parse the URL into its parts:
25672567
25682568``` js
2569- new URL (request .url , ` http://${ request .getHeaders () .host } ` );
2569+ new URL (request .url , ` http://${ request .headers .host } ` );
25702570```
25712571
2572- When ` request.url ` is ` '/status?name=ryan' ` and
2573- ` request.getHeaders().host ` is ` 'localhost:3000' ` :
2572+ When ` request.url ` is ` '/status?name=ryan' ` and ` request.headers.host ` is
2573+ ` 'localhost:3000' ` :
25742574
25752575``` console
25762576$ node
2577- > new URL(request.url, `http://${request.getHeaders () .host}` )
2577+ > new URL(request.url, ` http://${request.headers .host} ` )
25782578URL {
25792579 href: 'http://localhost:3000/status?name=ryan',
25802580 origin: 'http://localhost:3000',
0 commit comments