Fix outdated XHRExampleBinaryUpload example (#54803)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54803

The XMLHttpRequest `multipart/form-data` example in RNTester was referencing the `http://ptsv2.com/` test service, which no longer exists. Update this to `https://ptsv3.com/`.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D88493638

fbshipit-source-id: f55198ce7274d03a7ff1f548cdcf41221ec7e43b
This commit is contained in:
Alex Hunt authored and meta-codesync[bot] committed 2025-12-08 02:15:37 -08:00
1 parent 8347cc4b50
commit 2efa274c07
1 file changed
+5 -17
@@ -13,14 +13,7 @@
import RNTesterText from '../../components/RNTesterText';
import RNTOption from '../../components/RNTOption';
import React from 'react';
import {
Alert,
Linking,
StyleSheet,
Text,
TouchableHighlight,
View,
} from 'react-native';
import {Alert, StyleSheet, Text, TouchableHighlight, View} from 'react-native';
const BINARY_TYPES = {
String,
@@ -62,17 +55,12 @@ class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMe> {
Alert.alert('Upload failed', 'No response payload.');
return;
}
const index = xhr.responseText.indexOf(
'http://ptsv2.com/t/react-native/d/',
);
if (index === -1) {
const {status} = JSON.parse(xhr.responseText);
if (status !== 'success') {
Alert.alert('Upload failed', 'Invalid response payload.');
return;
}
const url = xhr.responseText.slice(index).split('\n')[0];
console.log('Upload successful: ' + url);
// $FlowFixMe[unused-promise]
Linking.openURL(url);
Alert.alert('Upload successful: https://ptsv3.com/react-native');
}
state: $FlowFixMe | {type: 'Uint8Array'} = {
@@ -81,7 +69,7 @@ class XHRExampleBinaryUpload extends React.Component<{...}, $FlowFixMe> {
_upload = () => {
const xhr = new XMLHttpRequest();
xhr.open('POST', 'http://ptsv2.com/t/react-native/post');
xhr.open('POST', 'https://ptsv3.com/t/react-native/post');
xhr.onload = () => XHRExampleBinaryUpload.handlePostTestServerUpload(xhr);
xhr.setRequestHeader('Content-Type', 'text/plain');