Skip to content

Commit b30a78a

Browse files
authored
Merge pull request #110 from stainless-api/sam/200-no-204
fix: return 200 instead of 204 for empty responses
2 parents 90c2c42 + 3690d45 commit b30a78a

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/hono/src/__tests__/honoPlugin.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ describe("void-returning handlers", () => {
3131
const app = new Hono();
3232
app.use("*", stlApi(api));
3333

34-
test("handler returning void responds with 204", async () => {
34+
test("handler returning void responds with 200", async () => {
3535
const response = await app.request("/api/webhooks/events", {
3636
method: "POST",
3737
});
38-
expect(response.status).toBe(204);
38+
expect(response.status).toBe(200);
3939
expect(await response.text()).toBe("");
4040
});
4141

42-
test("handler with explicit bare return responds with 204", async () => {
42+
test("handler with explicit bare return responds with 200", async () => {
4343
const response = await app.request("/api/webhooks/noop", {
4444
method: "POST",
4545
});
46-
expect(response.status).toBe(204);
46+
expect(response.status).toBe(200);
4747
expect(await response.text()).toBe("");
4848
});
4949
});

packages/hono/src/honoPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function makeHandler(endpoints: AnyEndpoint[], options?: StlAppOptions) {
9292
}
9393

9494
if (result === undefined) {
95-
return c.body(null, 204);
95+
return c.body(null, 200);
9696
}
9797

9898
return c.json(result);

0 commit comments

Comments
 (0)