Skip to content

Commit e3aba33

Browse files
committed
test: use only pathRewrite
1 parent 98bdf5a commit e3aba33

1 file changed

Lines changed: 6 additions & 27 deletions

File tree

test/server/proxy-option.test.js

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,14 @@ const proxyOptionPathsAsProperties = [
1818
target: `http://localhost:${port1}`,
1919
},
2020
{
21-
context: "/api/proxy2",
21+
path: "/api/proxy2",
2222
target: `http://localhost:${port2}`,
2323
pathRewrite: { "^/api": "" },
2424
},
2525
{
26-
context: "/foo",
27-
bypass(req) {
28-
if (/\.html$/.test(req.path || req.url)) {
29-
return "/index.html";
30-
}
31-
32-
return null;
33-
},
34-
},
35-
{
36-
context: "proxyfalse",
37-
bypass(req) {
38-
if (/\/proxyfalse$/.test(req.path || req.url)) {
39-
return false;
40-
}
41-
},
42-
},
43-
{
44-
context: "/bypass-with-target",
26+
pathFilter: "**/*.html",
4527
target: `http://localhost:${port1}`,
46-
changeOrigin: true,
47-
secure: false,
48-
bypass(req) {
49-
if (/\.(html)$/i.test(req.path || req.url)) {
50-
return req.url;
51-
}
52-
},
28+
pathRewrite: () => "/index.html",
5329
},
5430
];
5531

@@ -140,6 +116,9 @@ describe("proxy option", () => {
140116
proxyApp1.get("/api", (req, res) => {
141117
res.send("api response from proxy1");
142118
});
119+
proxyApp1.get("/index.html", (req, res) => {
120+
res.send("Hello");
121+
});
143122
proxyApp2.get("/proxy2", (req, res) => {
144123
res.send("from proxy2");
145124
});

0 commit comments

Comments
 (0)