Skip to content

Commit 0ebac19

Browse files
committed
test(path-rewriter): improve coverage
1 parent 468db39 commit 0ebac19

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/e2e/path-rewriter.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,26 @@ describe('E2E pathRewrite', () => {
5656
expect(response.text).toBe('/API RESPONSE AFTER PATH REWRITE FUNCTION');
5757
});
5858
});
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+
});
5981
});

0 commit comments

Comments
 (0)