Skip to content

Commit 387e1c4

Browse files
samsafayide
authored andcommitted
check for GET and Head in send request
Summary: React Native had an underlying problem connecting to Firestore (Google's latest database) from Android devices. You can follow the issue [here](firebase/firebase-js-sdk#283). The main problem was in NetworkingModule.java. Please refer to section 3 of 4.5.6 in whatwg.org's guideline https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send In this [video](https://www.youtube.com/watch?v=tILagf46ys8), I am showing how the react native behaved before adding the new fix and how it worked after the new fix added. The new fix starts at 50 seconds. [ANDROID] [BUGFIX] [FIRESTORE][XMLHttpRequest][ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java] - Fixes the connection to Firestore by following whatwg.org's XMLHttpRequest send() method Closes #17940 Differential Revision: D7173468 Pulled By: hramos fbshipit-source-id: 354d36f03d611889073553b93a7c43c6d4363ff3
1 parent 9a3cad4 commit 387e1c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public void onProgress(long bytesWritten, long contentLength, boolean done) {
344344
}
345345

346346
RequestBody requestBody;
347-
if (data == null) {
347+
if (data == null || method.toLowerCase().equals("get") || method.toLowerCase().equals("head")) {
348348
requestBody = RequestBodyUtil.getEmptyBody(method);
349349
} else if (handler != null) {
350350
requestBody = handler.toRequestBody(data, contentType);

0 commit comments

Comments
 (0)