@@ -195,17 +195,25 @@ export const prepareResponse = <
195195 statusText : response . statusText ,
196196
197197 // Convert methods to use arrow functions to preserve correct return types
198- blob : async ( ) =>
199- data instanceof ArrayBuffer ? new Blob ( [ data ] ) : new Blob ( ) , // Lazily construct Blob from ArrayBuffer
200- json : ( ) => Promise . resolve ( data ) as Promise < ResponseData > , // Return the already parsed JSON data
201- text : ( ) => Promise . resolve ( data ) as Promise < string > , // Return the already parsed text data
198+ blob : ( ) =>
199+ Promise . resolve (
200+ data instanceof ArrayBuffer ? new Blob ( [ data ] ) : new Blob ( ) ,
201+ ) , // Lazily construct Blob from ArrayBuffer
202+ json : ( ) => Promise . resolve ( data as ResponseData ) , // Return the already parsed JSON data
203+ text : ( ) => Promise . resolve ( data as string ) , // Return the already parsed text data
202204 clone : ( ) => response . clone ( ) ,
203- arrayBuffer : async ( ) =>
204- data instanceof ArrayBuffer ? data : new ArrayBuffer ( 0 ) , // Return the ArrayBuffer directly
205- formData : async ( ) => ( data instanceof FormData ? data : new FormData ( ) ) , // Return the already parsed FormData
206- bytes : async ( ) =>
207- data instanceof ArrayBuffer ? new Uint8Array ( data ) : new Uint8Array ( 0 ) , // Return bytes from ArrayBuffer
208-
205+ arrayBuffer : ( ) =>
206+ Promise . resolve (
207+ data instanceof ArrayBuffer ? data : new ArrayBuffer ( 0 ) ,
208+ ) , // Return the ArrayBuffer directly
209+ formData : ( ) =>
210+ Promise . resolve ( data instanceof FormData ? data : new FormData ( ) ) , // Return the already parsed FormData
211+ bytes : ( ) =>
212+ Promise . resolve (
213+ new Uint8Array (
214+ data instanceof ArrayBuffer ? data : new ArrayBuffer ( 0 ) ,
215+ ) ,
216+ ) ,
209217 // Enhance the response with extra information
210218 error,
211219 data,
0 commit comments