elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.23k stars 198 forks source link

Fix 204 returning internal server error #593

Closed kevainc-plop closed 3 months ago

kevainc-plop commented 3 months ago

When a route with a 204 would be called it would cause an internal server error with the message:

undefined is not an object (evaluating 'r[ELYSIA_RESPONSE]'

new Elysia()
.get("/fails", ({ set }) => {
  set.status = 204;
}, {
    response: {
      204: t.Void()
    }
})

This PR fixes this and added a test to avoid regression.

SaltyAom commented 3 months ago

Thanks for your contribution.

Unfortunately, we have shipped the fix in this commit, https://github.com/elysiajs/elysia/commit/0b2b04d631d6aecb71effea8f8bee2de62aba754.

Thank you for work nevertheless 😊