Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
zbrydon committed May 14, 2024
1 parent 32537d5 commit 20a7bd6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,4 +558,19 @@ describe("test/body-parser.test.ts", () => {
.expect({ foo: "bar" });
});
});

describe("request closed", () => {
it("should return 499 on request closed", async () => {
const app = new Koa();

app.use(async (ctx, next) => {
Object.defineProperty(ctx.req, "closed", { value: true });
await next();
});
app.use(bodyParser());
server = app.listen();

await request(server).post("/").send({ foo: "bar" }).expect(499);
});
});
});

0 comments on commit 20a7bd6

Please sign in to comment.