Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use response._bodyInit as fallback for react-native and qq #398

Merged
merged 11 commits into from
Oct 8, 2024
9 changes: 7 additions & 2 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ export function createFetch(globalOptions: CreateFetchOptions = {}): $Fetch {
}

const hasBody =
context.response.body &&
(context.response.body ||
// https://github.com/JakeChampion/fetch/issues/1454
(context.response as any)._bodyInit) &&
joshmossas marked this conversation as resolved.
Show resolved Hide resolved
!nullBodyResponses.has(context.response.status) &&
context.options.method !== "HEAD";
if (hasBody) {
Expand All @@ -213,7 +215,10 @@ export function createFetch(globalOptions: CreateFetchOptions = {}): $Fetch {
break;
}
case "stream": {
context.response._data = context.response.body;
context.response._data =
context.response.body ||
// https://github.com/JakeChampion/fetch/issues/1454
(context.response as any)._bodyInit;
break;
}
default: {
Expand Down