The return of the post is falling through the error callback yet the json I'm expecting is being returned by the api call. It is visible when I console.log the error object. I'll post the error log after the code.
The payload (userCreds) is json. Using postman, the api call returns as expected
Here's the post call:
var deferred = $q.defer();
$http.post(url, userCreds)
.then(function(data, status) {
$log.info('validateLogin status: ' + status)
if(data){
requestor = data;
}
deferred.resolve(requestor);
}, function (data, status) {
var error = data || "Request failed";
$log.error('validateLogin error: ' + JSON.stringify(error));
deferred.reject(error);
});
return deferred.promise;
The error object has the correct response in it with a 302 status. I noticed the transformRequest and transformResponse were null. I don't recall having to define these in the past. I thought angular automatically dealt with strings and javascript objects during transformations.
{"data":{"$id":"1","innCodes":[],"userTypeId":0,"formId":0,"onqUserId":null,"fullName":"User Smith","firstName":"User","lastName":"Smith","phone":"214-555-4450","email":"user@email.com","userId":null,"password":null,"title":"Project Manager","fax":null,"mobile":null,"role":null},"status":302,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"url":"http://localhost:25396/api/user/ValidateCredentials/","data":{"userName":"userid1234","password":"pwd123456"},"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"}},"statusText":"Found"}