We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d89b9a commit 486188fCopy full SHA for 486188f
packages/openapi-fetch/src/index.ts
@@ -68,11 +68,12 @@ export default function createClient<Paths extends {}>(clientOptions: ClientOpti
68
69
// parse response (falling back to .text() when necessary)
70
if (response.ok) {
71
- let data: any;
+ let data: any; // we have to leave this empty here so that we don't consume the body
72
if (parseAs !== "stream") {
73
const cloned = response.clone();
74
data = typeof cloned[parseAs] === "function" ? await cloned[parseAs]() : await cloned.text();
75
} else {
76
+ // bun consumes the body when calling response.body, therefore we need to clone the response before accessing it
77
data = response.clone().body;
78
}
79
return { data, response: response as any };
0 commit comments