mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
[ReactNative][Android] JS for D2294884: Allow XHR to send native files, as HTTP body or via multipart FormData
This commit is contained in:
parent
f41663a2df
commit
d858d0c4e0
@ -102,17 +102,19 @@ class XMLHttpRequest extends XMLHttpRequestBase {
|
||||
}
|
||||
|
||||
sendImpl(method: ?string, url: ?string, headers: Object, data: any): void {
|
||||
var body;
|
||||
if (typeof data === 'string') {
|
||||
data = {string: data};
|
||||
}
|
||||
if (data instanceof FormData) {
|
||||
data = {formData: data.getParts()};
|
||||
body = {string: data};
|
||||
} else if (data instanceof FormData) {
|
||||
body = {formData: data.getParts()};
|
||||
} else {
|
||||
body = data;
|
||||
}
|
||||
RCTNetworking.sendRequest(
|
||||
{
|
||||
method,
|
||||
url,
|
||||
data,
|
||||
body,
|
||||
headers,
|
||||
incrementalUpdates: this.onreadystatechange ? true : false,
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user