When I make a call to the endpoint using Postman, I receive this response:
https://i.stack.imgur.com/pH31G.png
However, when I make the same request from my AngularJS service defined below:
this.login = function (loginInfo) {
return $http({
url: 'http://localhost/igt/api/public/signin',
headers: {
'Content-Type': 'Application/json'
},
method: 'POST',
user: {
name: "nick",
password: "password"
}
})
.then(function(response) {
console.log(response);
}, function (err) {
console.log("err:");
console.log(err);
});
};
The output in the console looks like this:
https://i.stack.imgur.com/v0cDG.png
It shows the following response:
{
"data": null,
"status": 400,
"config": {
"method": "POST",
"transformRequest": [
null
],
"transformResponse": [
null
],
"jsonpCallbackParam": "callback",
"url": "http://localhost/igt/api/public/signin",
"headers": {
"Accept": "application/json, text/plain, */*"
},
"user": {
"name": "nick",
"password": "password"
}
},
"statusText": "Bad Request",
"xhrStatus": "complete"
}
What could be causing this difference?