-
-
Notifications
You must be signed in to change notification settings - Fork 591
Open
Labels
bugSomething isn't workingSomething isn't workingopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library
Description
Description
When a response has an empty body, the client fails with a JSON.parse error:
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:4747:19)
at successSteps (node:internal/deps/undici/undici:4718:27)
at specConsumeBody (node:internal/deps/undici/undici:4724:9)
at HttpResponse.json (node:internal/deps/undici/undici:4614:18)This error happens here. response[parseAs]() fails to convert the empty response to json and crashes, never reaching the fallback.
Expected result
The client should be able to handle empty responses without crashing with JSON.parse errors.
Checklist
- I’m willing to open a PR (see CONTRIBUTING.md)
fmajestic, konarskis and deerob4
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library
Type
Projects
Status
No status