File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ const pump = require('pump')
2
2
3
3
module . exports = async ( ) => {
4
4
return {
5
+ timeout : 1.5 * 1000 ,
6
+
5
7
middlewares : [
6
8
require ( 'cors' ) ( ) ,
7
9
require ( 'http-cache-middleware' ) ( )
Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ describe('API Gateway', () => {
33
33
res . setHeader ( 'x-cache-expire' , 'GET/users/*' )
34
34
res . send ( { } )
35
35
} )
36
+ remote . get ( '/longop' , ( req , res ) => {
37
+ setTimeout ( ( ) => {
38
+ res . send ( { } )
39
+ } , 2000 )
40
+ } )
36
41
remote . post ( '/204' , ( req , res ) => res . send ( 204 ) )
37
42
remote . get ( '/endpoint-proxy-methods' , ( req , res ) => res . send ( {
38
43
name : 'endpoint-proxy-methods'
@@ -155,6 +160,12 @@ describe('API Gateway', () => {
155
160
} )
156
161
} )
157
162
163
+ it ( 'Should timeout on GET /longop - 504' , async ( ) => {
164
+ return request ( gateway )
165
+ . get ( '/users/longop' )
166
+ . expect ( 504 )
167
+ } )
168
+
158
169
it ( 'GET /users/info - 200' , async ( ) => {
159
170
await request ( gateway )
160
171
. get ( '/users/info' )
You can’t perform that action at this time.
0 commit comments