Skip to content

Commit a55fe37

Browse files
authored
Checking For the GET or HEAD in send method
The following change is suggested by a Firebase member here. firebase/firebase-js-sdk#283 It follows the whatwg.org's send method guidelines. https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send At the section 3 of 4.5.6, it is suggests to check for the GET or HEAD methods, for every XMLHttpRequest send() method, then set the body to null if it is true.
1 parent efddf1d commit a55fe37

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
@@ -235,7 +235,7 @@ public void onProgress(long bytesWritten, long contentLength, boolean done) {
235235
String contentEncoding = requestHeaders.get(CONTENT_ENCODING_HEADER_NAME);
236236
requestBuilder.headers(requestHeaders);
237237

238-
if (data == null) {
238+
if (data == null || method.toLowerCase() === 'get' || method.toLowerCase() === 'head') {
239239
requestBuilder.method(method, RequestBodyUtil.getEmptyBody(method));
240240
} else if (data.hasKey(REQUEST_BODY_KEY_STRING)) {
241241
if (contentType == null) {

0 commit comments

Comments
 (0)