1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Fixed networking

This commit is contained in:
Laurent Cozic
2020-10-14 16:54:42 +01:00
parent 6ff45ce485
commit 0c0d228815
4 changed files with 27 additions and 3 deletions

View File

@ -44,6 +44,13 @@ function shimInit() {
if (!validatedUrl) throw new Error(`Not a valid URL: ${url}`);
return shim.fetchWithRetry(() => {
// If the request has a body and it's not a GET call, and it doesn't have a Content-Type header
// we display a warning, because it could trigger a "Network request failed" error.
// https://github.com/facebook/react-native/issues/30176
if (options?.body && options?.method && options.method !== 'GET' && !options?.headers?.['Content-Type']) {
console.warn('Done a non-GET fetch call without a Content-Type header. It may make the request fail.', url, options);
}
return fetch(validatedUrl, options);
}, options);
};