File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ module.exports = async () => {
92
92
target : 'http://localhost:3000' ,
93
93
methods : [ 'GET' ] ,
94
94
hooks : {
95
+ onRequest : ( req ) => {
96
+ req . query . name = 'fast-gateway'
97
+ } ,
95
98
queryString : {
96
99
name : 'qs-overwrite'
97
100
}
Original file line number Diff line number Diff line change @@ -308,16 +308,17 @@ describe('API Gateway', () => {
308
308
} )
309
309
} )
310
310
311
- it ( 'GET /qs - 200' , async ( ) => {
311
+ it ( '(Should overwrite query string using req.query) GET /qs - 200' , async ( ) => {
312
312
await request ( gateway )
313
- . get ( '/qs' )
313
+ . get ( '/qs?name=nodejs&category=js ' )
314
314
. expect ( 200 )
315
315
. then ( ( response ) => {
316
316
expect ( response . body . name ) . to . equal ( 'fast-gateway' )
317
+ expect ( response . body . category ) . to . equal ( 'js' )
317
318
} )
318
319
} )
319
320
320
- it ( 'GET /qs2 - 200' , async ( ) => {
321
+ it ( '(Should overwrite query string using queryString option) GET /qs2 - 200' , async ( ) => {
321
322
await request ( gateway )
322
323
. get ( '/qs2?name=fast-gateway' )
323
324
. expect ( 200 )
You can’t perform that action at this time.
0 commit comments