Fix XHR multipart form upload example
Summary: Changelog: [Internal] - Update XHR upload example to new post test server. Created new toilet here: http://ptsv2.com/t/react-native and configured to return the link to the post data Reviewed By: kacieb Differential Revision: D29082824 fbshipit-source-id: 0cb502286addf1de3d5053f73173551ddd180a96
This commit is contained in:
Родитель
cf2238eb66
Коммит
993d022d4b
|
@ -62,7 +62,9 @@ class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMeState> {
|
||||||
Alert.alert('Upload failed', 'No response payload.');
|
Alert.alert('Upload failed', 'No response payload.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const index = xhr.responseText.indexOf('http://www.posttestserver.com/');
|
const index = xhr.responseText.indexOf(
|
||||||
|
'http://ptsv2.com/t/react-native/d/',
|
||||||
|
);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
Alert.alert('Upload failed', 'Invalid response payload.');
|
Alert.alert('Upload failed', 'Invalid response payload.');
|
||||||
return;
|
return;
|
||||||
|
@ -78,7 +80,7 @@ class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMeState> {
|
||||||
|
|
||||||
_upload = () => {
|
_upload = () => {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', 'http://posttestserver.com/post.php');
|
xhr.open('POST', 'http://ptsv2.com/t/react-native/post');
|
||||||
xhr.onload = () => XHRExampleBinaryUpload.handlePostTestServerUpload(xhr);
|
xhr.onload = () => XHRExampleBinaryUpload.handlePostTestServerUpload(xhr);
|
||||||
xhr.setRequestHeader('Content-Type', 'text/plain');
|
xhr.setRequestHeader('Content-Type', 'text/plain');
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче