You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create new project with fetch client from openapi scheme which returns 204 (No content).
Try calling the generated method.
You should get error Unexpected end of JSON input error.
What happens?
Basically when there is no response in fetch client response there is no content. Which mean the res.json() will throw error.
Generated code looks like this:
constdata=awaitres.json()return{status: res.status, data }
What were you expecting to happen?
There shouldn't be a error.
Any logs, error output, etc?
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:4306:19)
at successSteps (node:internal/deps/undici/undici:4288:27)
at consumeBody (node:internal/deps/undici/undici:4294:9)
at _Response.json (node:internal/deps/undici/undici:4239:18)
Any other comments?
I think when there is 204 in specs or there is no content in openapi specification the const data should not be generated and data should not be required in generated responses as there are none.
What are the steps to reproduce this issue?
fetch
client from openapi scheme which returns 204 (No content).What happens?
Basically when there is no response in fetch client response there is no content. Which mean the res.json() will throw error.
Generated code looks like this:
What were you expecting to happen?
There shouldn't be a error.
Any logs, error output, etc?
Any other comments?
I think when there is 204 in specs or there is no content in openapi specification the const data should not be generated and data should not be required in generated responses as there are none.
What versions are you using?
The text was updated successfully, but these errors were encountered: