mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 14:13:26 +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 {
|
sendImpl(method: ?string, url: ?string, headers: Object, data: any): void {
|
||||||
|
var body;
|
||||||
if (typeof data === 'string') {
|
if (typeof data === 'string') {
|
||||||
data = {string: data};
|
body = {string: data};
|
||||||
}
|
} else if (data instanceof FormData) {
|
||||||
if (data instanceof FormData) {
|
body = {formData: data.getParts()};
|
||||||
data = {formData: data.getParts()};
|
} else {
|
||||||
|
body = data;
|
||||||
}
|
}
|
||||||
RCTNetworking.sendRequest(
|
RCTNetworking.sendRequest(
|
||||||
{
|
{
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
data,
|
body,
|
||||||
headers,
|
headers,
|
||||||
incrementalUpdates: this.onreadystatechange ? true : false,
|
incrementalUpdates: this.onreadystatechange ? true : false,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user