问题
I have this post request in React JS : I need to pass files using Rest API and receive a response to the react but when I do that I get error . Rest Api written in python and there I do some process on the files
let postR = []
results.map(async result => {
// const response = await Promise.axios.post(
postR.push(
axios.post(
'https://52.14.247.16:5000/process',
{ result },
{ headers: { 'Content-Type': 'application/json' } }
)
)
})
Promise.all(postR).then(res => {
console.log(res)
this.getRequest()
})
and here the get request that I sent from the react to do something there:
getRequest = async () => {
axios
.get(
'https://52.14.247.16:5000/start/' +
this.props.maxLen +
'+' +
this.props.minLen +
'+' +
this.props.maxDistance +
'+' +
this.props.minDistance +
'+' +
this.props.MicrobeType +
'+' +
this.state.files.length
)
.then(response => {
console.log(response.data)
//alert(response.data.value);
console.log(response.data.value)
// document.getElementById("output").innerHTML =response.data.value;
this.downloadTxtFile(response.data.value)
})
.catch(function (error) {
console.log(error)
alert('Problem at the server\nTry later\n' + error)
})
}
so I receive errors like that :
xhr.js:178 POST https://52.14.247.16:5000/process net::ERR_SSL_PROTOCOL_ERROR
createError.js:16 Uncaught (in promise) Error: Network Error
at createError (createError.js:16)
at XMLHttpRequest.handleError (xhr.js:83)
POST https://52.14.247.16:5000/process net::ERR_SSL_PROTOCOL_ERROR
I need a help !
来源:https://stackoverflow.com/questions/62601703/axios-request-error-ssl-connection-error-react-js