closure-library icon indicating copy to clipboard operation
closure-library copied to clipboard

Setting body to empty string on GET requests breaks for android in react native

Open Naomarik opened this issue 7 years ago • 0 comments

https://github.com/google/closure-library/blob/9e1fdcab653bed917bc81fe4a88d05883a8c7188/closure/goog/net/xhrio.js#L562

Specifically this line is causing issues. Could we conditionally set the body to an empty string only if the request method is not GET?

This causes react native on Android to fail with error code 6 (invalid HTTP response) even though it never hits the endpoint, and last error is unhelpfully set to "undefined [0]".

I've verified that changing the content back to null after this line solves the issue and successfully performs the request.

RN version 50.4

Naomarik avatar Dec 12 '17 15:12 Naomarik