反应js AXIOS认证因网络错误而失败

时间:2017-11-09 16:08:18

标签: reactjs axios

我在执行axios.post请求时遇到网络错误。

axios.post({
    method:'POST',
    url:'http://xxx.xxx.xxx.xxx:6310',
    withCredentials: true,
    auth: { username: 'username',
            password: 'password'},
    headers: {'Content-Type': 'application/x-www-form-urlencoded',
  'Accept': 'application/json'},
    data :{"jsonrpc":"1.0", "method":"liststreams","params":[]}
  }).then(function(response) {
    console.log('res  ------- ',response)
  }).catch(function(error) {
    console.log('error =',error)
  })

谢谢,

0 个答案:

没有答案