I'm making an ajax call from Angular JS:
var response = $http.post(
'/services/login/?_nochache='+new Date().getTime(),
JSON.stringify(credentials)
);
I'm adding the _nocache
setting, thinking that maybe some cache or something like that.
I'm also converting the object credentials
into string thinking that Internet Explorer could not recognise the object.
I'm really lost here, In chrome the call works perfectly, in IE 10, the response of the service is null.
What can be causing this?
EDIT
The service is returning 401, which is ok, since the user is wrong, but the response should be (as is in other browsers), the error string saying the user is wrong, in this case is null.
I'm using the promise like this:
promise.then(onLoginOk, onLoginError);
...
function onLoginError(response) {
console.log(JSON.stringify(response));
}
The console returns
{
"data": null,
"status": -1,
"config": {
"method": "POST",
"transformRequest": [
null
],
"transformResponse": [
null
],
"url": "http://dev.site.com:8000/api/auth/login/",
"data": {
"username": "mail@domain.com",
"password": "password"
},
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json;charset=utf-8"
}
},
"statusText": ""
}
EDIT
Here is the Response body I get in IE.
These are the headers I get with the 401
which is correct, but the response body is wrong.