我在 React JS 中有这个发布请求:
我需要使用 Rest API 传递文件并接收对 React 的响应
但当我这样做时,我收到错误。
用 python 编写的 Rest Api,我对文件做了一些处理
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()
})
这里是我从 React 发送来执行某些操作的 get 请求:
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)
})
}
所以我收到这样的错误:
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
我需要帮助!
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)