mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
[ReactNative][Android] JS for D2294884: Allow XHR to send native files, as HTTP body or via multipart FormData
This commit is contained in:
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user