Skip to content

Commit

Permalink
Fix XHR multipart form upload example
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Luna Wei authored and facebook-github-bot committed Jun 15, 2021
1 parent cf2238e commit 993d022
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/rn-tester/js/examples/XHR/XHRExampleBinaryUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMeState> {
Alert.alert('Upload failed', 'No response payload.');
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) {
Alert.alert('Upload failed', 'Invalid response payload.');
return;
Expand All @@ -78,7 +80,7 @@ class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMeState> {

_upload = () => {
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.setRequestHeader('Content-Type', 'text/plain');

Expand Down

0 comments on commit 993d022

Please sign in to comment.