Skip to content

Commit ee9f90b

Browse files
committed
feat: add tests for proxy
1 parent 6d928a0 commit ee9f90b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/unit/proxy.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,21 @@ describe("proxy", () => {
102102
expect(resp.status).toBe(200)
103103
expect(await resp.json()).toBe("coder is the best")
104104
})
105+
106+
it("should handle bad requests", async () => {
107+
e.use(bodyParser.json({ strict: false }))
108+
e.post("/wsup", (req, res) => {
109+
res.json(req.body)
110+
})
111+
codeServer = await integration.setup(["--auth=none"], "")
112+
const resp = await codeServer.fetch(proxyPath, {
113+
method: "post",
114+
body: "coder is the best",
115+
headers: {
116+
"Content-Type": "application/json",
117+
},
118+
})
119+
expect(resp.status).toBe(400)
120+
expect(resp.statusText).toMatch("Bad Request")
121+
})
105122
})

0 commit comments

Comments
 (0)