From b7ab3d37202979e0c83db078d3fa8eb2f623c453 Mon Sep 17 00:00:00 2001 From: suhaotian Date: Thu, 25 Apr 2024 10:21:49 +1000 Subject: [PATCH] chore: update code --- src/xior.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xior.ts b/src/xior.ts index 7c2279b..34a4e6b 100644 --- a/src/xior.ts +++ b/src/xior.ts @@ -26,7 +26,7 @@ export type XiorInstance = xior; async function getResponseData( response: Response, - responseType?: 'json' | 'text' | 'stream' | 'document' | 'arraybuffer' | 'blob' | 'original' + responseType?: 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream' | 'document' | 'original' ) { let data: any; if (!responseType || !response.ok || ['text', 'json'].includes(responseType)) { @@ -38,9 +38,9 @@ async function getResponseData( } catch (e) {} } } else if (responseType === 'blob') { - data = await response.blob(); + return response.blob(); } else if (responseType === 'arraybuffer') { - data = await response.arrayBuffer(); + return response.arrayBuffer(); } return data; }