imballinst / oas-typescript

All about OpenAPI stuff. Generators, enhanced Swagger UI, Zod validation, and more!
https://imballinst.github.io/oas-typescript/
MIT License
1 stars 0 forks source link

revisit the ctx body and 204 stuff #74

Closed imballinst closed 11 months ago

imballinst commented 11 months ago

https://github.com/koajs/koa/blob/master/docs/api/response.md#responsebody-1

If response.status has not been set, Koa will automatically set the status to 200 or 204 depending on response.body. Specifically, if response.body has not been set or has been set as null or undefined, Koa will automatically set response.status to 204. If you really want to send no content response with other status, you should override the 204 status as the following way: