File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -209,12 +209,15 @@ export function createFetch(globalOptions: CreateFetchOptions = {}): $Fetch {
209209 /* Custom response.text() function to retrieve text from response and get progress values */
210210 let loaded = 0 ;
211211 const contentLength =
212- context . response ! . headers . get ( "content-length" ) ! ;
213- const _reader = context . response ! . body ! . getReader ( ) ;
212+ context . response ? .headers . get ( "content-length" ) || "0" ;
213+ const _reader = context . response ? .body ? .getReader ( ) ;
214214 const _decoder = new TextDecoder ( ) ;
215215 const _chunks : string [ ] = [ ] ;
216216
217217 async function read ( ) : Promise < string > {
218+ if ( ! _reader ) {
219+ return "" ;
220+ }
218221 const { done, value } = await _reader . read ( ) ;
219222
220223 if ( done ) {
You can’t perform that action at this time.
0 commit comments