File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/openapi-fetch/src Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,13 @@ export default function createClient<Paths extends {}>(clientOptions: ClientOpti
6868
6969 // parse response (falling back to .text() when necessary)
7070 if ( response . ok ) {
71- let data : any = response . body ;
71+ let data : any ; // we have to leave this empty here so that we don't consume the body
7272 if ( parseAs !== "stream" ) {
7373 const cloned = response . clone ( ) ;
7474 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 ;
7578 }
7679 return { data, response : response as any } ;
7780 }
You can’t perform that action at this time.
0 commit comments