File tree 3 files changed +13
-6
lines changed
3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -556,7 +556,7 @@ Returns `request`.
556
556
added: v0.1.17
557
557
-->
558
558
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:
560
560
561
561
### Event: 'checkContinue'
562
562
<!-- YAML
@@ -982,6 +982,11 @@ header-related http module methods. The keys of the returned object are the
982
982
header names and the values are the respective header values. All header names
983
983
are lowercase.
984
984
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
+
985
990
Example:
986
991
987
992
``` 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:
68
68
```
69
69
70
70
* 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* .
74
74
75
75
By default, percent-encoded characters within the query string will be assumed
76
76
to 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) => {
43
43
switch ( test ) {
44
44
case 'headers' :
45
45
// 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 ) ;
48
49
assert . deepStrictEqual ( res . getHeaderNames ( ) , [ ] ) ;
49
50
assert . deepStrictEqual ( res . hasHeader ( 'Connection' ) , false ) ;
50
51
assert . deepStrictEqual ( res . getHeader ( 'Connection' ) , undefined ) ;
@@ -72,6 +73,7 @@ const s = http.createServer(common.mustCall((req, res) => {
72
73
assert . strictEqual ( res . getHeader ( 'x-test-header2' ) , 'testing' ) ;
73
74
74
75
const headersCopy = res . getHeaders ( ) ;
76
+ assert . strictEqual ( Object . getPrototypeOf ( headersCopy ) , null ) ;
75
77
// eslint-disable-next-line no-restricted-properties
76
78
assert . deepEqual ( headersCopy , {
77
79
'x-test-header' : 'testing' ,
You can’t perform that action at this time.
0 commit comments