mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Add query string to express integration test
This commit is contained in:
@@ -39,13 +39,17 @@ test("httpServer", async () => {
|
||||
// This throws a TypeError since it uses body-parser.json
|
||||
app.post("/ping", (request: Request, response: Response) => {
|
||||
expect(request.body).toEqual({ hello: "world" });
|
||||
expect(request.query).toStrictEqual({
|
||||
hello: "123",
|
||||
hi: "",
|
||||
});
|
||||
reached = true;
|
||||
response.status(200).send("POST - pong");
|
||||
httpServer.close();
|
||||
});
|
||||
|
||||
httpServer.listen(PORT);
|
||||
const resp = await fetch(`http://localhost:${PORT}/ping`, {
|
||||
const resp = await fetch(`http://localhost:${PORT}/ping?hello=123&hi`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ hello: "world" }),
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user