-
-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
createJsonMutation have a responce.body check
async function isEmptyResponse(response: Response): Promise<boolean> {
if (!response.body) {
return true;
}
const headerAsEmpty = response.headers.get('Content-Length') === '0';
if (headerAsEmpty) {
return true;
}
// Clone response to read it
// because response can be read only once
const clonnedResponse = response.clone();
const bodyAsText = await clonnedResponse.text();
if (bodyAsText.length === 0) {
return true;
}
return false;
}
In React Native, response.body is always null / undefined (because there is no ReadableStream), even when the response actually has a body and a valid Content-Length.
As a result, this condition:
if (!response.body) {
return true;
}
makes isEmptyResponse always return true on React Native
Metadata
Metadata
Assignees
Labels
No labels