File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -56,4 +56,26 @@ describe('E2E pathRewrite', () => {
56
56
expect ( response . text ) . toBe ( '/API RESPONSE AFTER PATH REWRITE FUNCTION' ) ;
57
57
} ) ;
58
58
} ) ;
59
+
60
+ describe ( 'Rewrite paths with function which return undefined' , ( ) => {
61
+ it ( 'should proxy with requested path' , async ( ) => {
62
+ mockTargetServer
63
+ . get ( '/api/lorum/ipsum' )
64
+ . thenReply ( 200 , '/API RESPONSE AFTER PATH REWRITE FUNCTION' ) ;
65
+
66
+ const agent = request (
67
+ createApp (
68
+ createProxyMiddleware ( {
69
+ target : `http://localhost:${ mockTargetServer . port } ` ,
70
+ pathRewrite ( path , req ) {
71
+ return undefined ;
72
+ } ,
73
+ } )
74
+ )
75
+ ) ;
76
+
77
+ const response = await agent . get ( '/api/lorum/ipsum' ) . expect ( 200 ) ;
78
+ expect ( response . text ) . toBe ( '/API RESPONSE AFTER PATH REWRITE FUNCTION' ) ;
79
+ } ) ;
80
+ } ) ;
59
81
} ) ;
You can’t perform that action at this time.
0 commit comments