File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -556,7 +556,7 @@ Returns `request`.
556556added: v0.1.17
557557-->
558558
559- This class inherits from [ ` net.Server ` ] [ ] and has the following additional events:
559+ This class inherits from [ ` net.Server ` ] [ ] and has the following additional events:
560560
561561### Event: 'checkContinue'
562562<!-- YAML
@@ -982,6 +982,11 @@ header-related http module methods. The keys of the returned object are the
982982header names and the values are the respective header values. All header names
983983are lowercase.
984984
985+ * Note* : The object returned by the ` response.getHeaders() ` method _ does not_
986+ prototypically inherit from the JavaScript ` Object ` . This means that typical
987+ ` Object ` methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` , and others
988+ are not defined and * will not work* .
989+
985990Example:
986991
987992``` js
Original file line number Diff line number Diff line change @@ -68,9 +68,9 @@ For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into:
6868```
6969
7070* Note* : The object returned by the ` querystring.parse() ` method _ does not_
71- prototypically extend from the JavaScript ` Object ` . This means that the
72- typical ` Object ` methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` ,
73- and others are not defined and * will not work* .
71+ prototypically inherit from the JavaScript ` Object ` . This means that typical
72+ ` Object ` methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` , and others
73+ are not defined and * will not work* .
7474
7575By default, percent-encoded characters within the query string will be assumed
7676to use UTF-8 encoding. If an alternative character encoding is used, then an
Original file line number Diff line number Diff line change @@ -43,8 +43,9 @@ const s = http.createServer(common.mustCall((req, res) => {
4343 switch ( test ) {
4444 case 'headers' :
4545 // Check that header-related functions work before setting any headers
46- // eslint-disable-next-line no-restricted-properties
47- assert . deepEqual ( res . getHeaders ( ) , { } ) ;
46+ const headers = res . getHeaders ( ) ;
47+ const exoticObj = Object . create ( null ) ;
48+ assert . deepStrictEqual ( headers , exoticObj ) ;
4849 assert . deepStrictEqual ( res . getHeaderNames ( ) , [ ] ) ;
4950 assert . deepStrictEqual ( res . hasHeader ( 'Connection' ) , false ) ;
5051 assert . deepStrictEqual ( res . getHeader ( 'Connection' ) , undefined ) ;
@@ -72,6 +73,7 @@ const s = http.createServer(common.mustCall((req, res) => {
7273 assert . strictEqual ( res . getHeader ( 'x-test-header2' ) , 'testing' ) ;
7374
7475 const headersCopy = res . getHeaders ( ) ;
76+ assert . strictEqual ( Object . getPrototypeOf ( headersCopy ) , null ) ;
7577 // eslint-disable-next-line no-restricted-properties
7678 assert . deepEqual ( headersCopy , {
7779 'x-test-header' : 'testing' ,
You can’t perform that action at this time.
0 commit comments