File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ class Headers {
9
9
10
10
// Initialize the headers
11
11
for ( const key in initialHeaders ) {
12
- headers [ key ] = initialHeaders [ key ] ;
12
+ let value = initialHeaders [ key ] ;
13
+
14
+ // Allow only string values
15
+ if ( typeof value === "string" ) {
16
+ headers [ key ] = value ;
17
+ }
13
18
}
14
19
15
20
this . headers = headers ;
Original file line number Diff line number Diff line change @@ -10,7 +10,15 @@ import httpStatus from "http-status";
10
10
class Response {
11
11
constructor ( body , options = { } ) {
12
12
this . body = body ;
13
- this . headers = new Headers ( options . headers || { } ) ;
13
+
14
+ if ( options . headers instanceof Headers ) {
15
+ this . headers = options . headers ;
16
+ } else if ( options . headers instanceof Object ) {
17
+ this . headers = new Headers ( options . headers ) ;
18
+ } else {
19
+ this . headers = new Headers ( { } ) ;
20
+ }
21
+
14
22
this . status = options . status || 200 ;
15
23
this . statusText = options . statusText || httpStatus [ this . status ] ;
16
24
}
You can’t perform that action at this time.
0 commit comments