Skip to content

Commit

Permalink
fix: use response._bodyInit as fallback for react-native and qq (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmossas authored Oct 8, 2024
1 parent 80aa991 commit 3617666
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ export function createFetch(globalOptions: CreateFetchOptions = {}): $Fetch {
}

const hasBody =
context.response.body &&
(context.response.body ||
// https://github.com/unjs/ofetch/issues/324
// https://github.com/unjs/ofetch/issues/294
// https://github.com/JakeChampion/fetch/issues/1454
(context.response as any)._bodyInit) &&
!nullBodyResponses.has(context.response.status) &&
context.options.method !== "HEAD";
if (hasBody) {
Expand All @@ -222,7 +226,8 @@ export function createFetch(globalOptions: CreateFetchOptions = {}): $Fetch {
break;
}
case "stream": {
context.response._data = context.response.body;
context.response._data =
context.response.body || (context.response as any)._bodyInit; // (see refs above)
break;
}
default: {
Expand Down

0 comments on commit 3617666

Please sign in to comment.