File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 15
15
"@commitlint/config-angular" : " ^4.3.0" ,
16
16
"@commitlint/config-lerna-scopes" : " ^4.3.0" ,
17
17
"@types/mocha" : " ^2.2.44" ,
18
- "@types/node" : " ^8.0.50 " ,
18
+ "@types/node" : " ^8.0.56 " ,
19
19
"@types/request" : " ^2.0.7" ,
20
20
"@types/request-promise" : " ^4.1.39" ,
21
21
"coveralls" : " ^3.0.0" ,
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export interface ParsedRequest extends ServerRequest {
11
11
// see http://expressjs.com/en/4x/api.html#req.path
12
12
path : string ;
13
13
// see http://expressjs.com/en/4x/api.html#req.query
14
- query : { [ key : string ] : string } ;
14
+ query : { [ key : string ] : string | string [ ] } ;
15
15
// see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15808
16
16
url : string ;
17
17
pathname : string ;
Original file line number Diff line number Diff line change @@ -45,7 +45,13 @@ export function parseRequestUrl(request: ServerRequest): ParsedRequest {
45
45
const parsedRequest = request as ParsedRequest ;
46
46
const parsedUrl = url . parse ( parsedRequest . url , true ) ;
47
47
parsedRequest . path = parsedUrl . pathname || '/' ;
48
- parsedRequest . query = parsedUrl . query ;
48
+ // parsedUrl.query cannot be a string as it is parsed with
49
+ // parseQueryString = true
50
+ if ( parsedUrl . query != null && typeof parsedUrl . query !== 'string' ) {
51
+ parsedRequest . query = parsedUrl . query ;
52
+ } else {
53
+ parsedRequest . query = { } ;
54
+ }
49
55
return parsedRequest ;
50
56
}
51
57
You can’t perform that action at this time.
0 commit comments