Skip to content

Commit 67c0784

Browse files
committed
test: remove another test
Just like in the previous commit, the router, or any other handler ,does not allow sending data; it only changes where the request should be forwarded via the proxy. Therefore, it doesn’t make sense to keep this test.
1 parent 0e0bd6c commit 67c0784

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

test/server/proxy-option.test.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const proxyOption = [
6464
let maxServerListeners = 0;
6565
const proxyOptionOfArray = [
6666
{ context: "/proxy1", target: `http://localhost:${port1}` },
67-
function proxy(req, res, next) {
67+
function proxy(req) {
6868
if (req) {
6969
const socket = req.socket || req.connection;
7070
const server = socket ? socket.server : null;
@@ -79,19 +79,6 @@ const proxyOptionOfArray = [
7979
context: "/api/proxy2",
8080
target: `http://localhost:${port2}`,
8181
pathRewrite: { "^/api": "" },
82-
bypass: () => {
83-
if (req) {
84-
const resolveUrl = new URL(req.url, `http://${req.headers.host}`);
85-
const params = new URLSearchParams(resolveUrl.search);
86-
const foo = params.get("foo");
87-
88-
if (foo) {
89-
res.end(`foo+${next.name}+${typeof next}`);
90-
91-
return false;
92-
}
93-
}
94-
},
9582
};
9683
},
9784
];
@@ -478,13 +465,6 @@ describe("proxy option", () => {
478465
expect(response.text).toContain("from proxy2");
479466
});
480467

481-
it("should allow req, res, and next", async () => {
482-
const response = await req.get("/api/proxy2?foo=true");
483-
484-
expect(response.statusCode).toBe(200);
485-
expect(response.text).toBe("foo+next+function");
486-
});
487-
488468
it("should not exist multiple close events registered", async () => {
489469
expect(maxServerListeners).toBeLessThanOrEqual(1);
490470
});

0 commit comments

Comments
 (0)