File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ const {
35
35
ObjectCreate,
36
36
ObjectDefineProperty,
37
37
ObjectKeys,
38
+ ObjectValues,
38
39
ObjectPrototypeHasOwnProperty,
39
40
ObjectSetPrototypeOf,
40
41
RegExpPrototypeTest,
@@ -602,6 +603,12 @@ OutgoingMessage.prototype.getHeaderNames = function getHeaderNames() {
602
603
} ;
603
604
604
605
606
+ // Returns an array of the names of the current outgoing raw headers.
607
+ OutgoingMessage . prototype . getRawHeaderNames = function getRawHeaderNames ( ) {
608
+ return this [ kOutHeaders ] !== null ? ObjectValues ( this [ kOutHeaders ] ) : [ ] ;
609
+ } ;
610
+
611
+
605
612
// Returns a shallow copy of the current outgoing headers.
606
613
OutgoingMessage . prototype . getHeaders = function getHeaders ( ) {
607
614
const headers = this [ kOutHeaders ] ;
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ function nextTest() {
171
171
172
172
let bufferedResponse = '' ;
173
173
174
- http . get ( { port : s . address ( ) . port } , common . mustCall ( ( response ) => {
174
+ const req = http . get ( { port : s . address ( ) . port , headers : { 'X-foo' : 'bar' } } , common . mustCall ( ( response ) => {
175
175
switch ( test ) {
176
176
case 'headers' :
177
177
assert . strictEqual ( response . statusCode , 201 ) ;
@@ -214,4 +214,9 @@ function nextTest() {
214
214
common . mustCall ( nextTest ) ( ) ;
215
215
} ) ) ;
216
216
} ) ) ;
217
+
218
+ assert . deepStrictEqual ( req . getHeaderNames ( ) ,
219
+ [ 'x-foo' , 'host' ] ) ;
220
+ assert . deepStrictEqual ( req . getRawHeaderNames ( ) ,
221
+ [ 'X-foo' , 'Host' ] ) ;
217
222
}
You can’t perform that action at this time.
0 commit comments