question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

in ios version 12.0, Axios Post resquest data ,response status is 0, response is undefind

See original GitHub issue
// package.json
"Axios":"^0.16.2"

IOS version: 12.0 dev

response

tim 20180611174156 1 2 3

server Api does not receive link requests ,this request is not sent to the back end

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21

github_iconTop GitHub Comments

7reactions
stonemakerscommented, Jun 13, 2018

I have solved my problem. I changed my post method in this way:

axios.post( apiUrl, qs.stringify({name: 'testName', pass: 'testPass'}), {
  headers: {
     'Content-Type': 'application/x-www-form-urlencoded'
  }
}).then(//***).catch(//***)
1. install qs module, and use qs.stringify(dataObject) to format your data object
2. add axios config 
{
  headers: {
     'Content-Type': 'application/x-www-form-urlencoded'
  }
}

Here are sth comment about axios post: link

1reaction
kulouhaishangbencommented, Mar 23, 2020

io原因是跨域请求会有问题,不支持Access-Control-Allow-Headers : *这种通配符; 解决方式:服务端把需要跨域的请求头设置给Access-Control-Allow-Headers,不用通配符; 参考了:https://blog.csdn.net/biakia0610/article/details/103777597 https://blog.csdn.net/Daijianshi_123/article/details/102853654

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axios POST response is undefined but network shows a ...
The trouble here is that axios doesn't resolve post calls with 400-status responses; it throws an error that you can catch.
Read more >
cannot read properties of undefined (reading 'data') axios
It seems this error is thrown when the device has network issues - a bunch of get rest api and cognito requests return...
Read more >
Understanding Axios POST requests - LogRocket Blog
Learn how to use the Axios POST method in both vanilla JavaScript and in a framework like React to send requests.
Read more >
axios - npm
response ) { // The request was made and the server responded with a status code // that falls out of the range...
Read more >
Content-Length - HTTP - MDN Web Docs
The Content-Length header indicates the size of the message body, in bytes, sent to the recipient. Header type, Request header, Response ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found