Axios request error SSL connection error React JS

谁都会走 提交于 2020-07-03 17:43:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!