We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 468db39 commit 0ebac19Copy full SHA for 0ebac19
test/e2e/path-rewriter.spec.ts
@@ -56,4 +56,26 @@ describe('E2E pathRewrite', () => {
56
expect(response.text).toBe('/API RESPONSE AFTER PATH REWRITE FUNCTION');
57
});
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
81
0 commit comments