elysiajs / elysia-swagger

A plugin for Elysia to auto-generate Swagger page
MIT License
74 stars 36 forks source link

Empty Response Body When Bad Request #99

Open victormongi opened 5 months ago

victormongi commented 5 months ago
Screenshot 2024-02-07 at 4 19 19 PM

What I expected the validation error from api, but got {}, this the example from postman

Screenshot 2024-02-07 at 4 24 13 PM
JoeyRichter commented 5 months ago

I am having the same issue. Additionally, if I return a plain text response () => 'Hello, World!', the response body from Scalar is empty. Neither of these issues are present with the swagger-ui provider.

SelfhostedPro commented 4 months ago

If you're using bun as the runtime, the headers get set as an octet/stream instead of text/html or application/json. With Node, I don't run into the issue. If you go to the api endpoint you'll download a file instead of getting raw json/text/whatever.

SelfhostedPro commented 4 months ago

If you're using bun as the runtime, the headers get set as an octet/stream instead of text/html or application/json. With Node, I don't run into the issue. If you go to the api endpoint you'll download a file instead of getting raw json/text/whatever.