Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-guests-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"swagger-typescript-api": patch
---

Fix fetch client response parsing without re-reading body.
3 changes: 2 additions & 1 deletion templates/base/http-clients/fetch-http-client.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ export class HttpClient<SecurityDataType = unknown> {
r.data = (null as unknown) as T;
r.error = (null as unknown) as E;

const data = !responseFormat ? r : await response[responseFormat]()
const responseToParse = responseFormat ? response.clone() : response;
const data = !responseFormat ? r : await responseToParse[responseFormat]()
.then((data) => {
if (r.ok) {
r.data = data;
Expand Down
Loading