I trying to make a POST request to my REST API. Here is the code snippet (using AngularJS):
$http({
method: 'POST',
url: url,
data: reqBody,
headers: {
'content-type': 'application/json'
}
})
.then(function (response) {...})
.catch(function (error) {...});
According to this article, because of the HTTP header
'content-type': 'application/json'
browser concludes that it will have to make an "not-simple" HTTP request which requires handshake with a server (HTTP options request will be sent before actual HTTP request).
Chrome handles the request like a charm, but IE (11 in my case) fails with the following messages:
The thing is, HTTP options response contains everything the browser needs to proceed with the actual HTTP request.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…