In my Web API 2 POST method, I am returning IHttpActionResult
public IHttpActionResult PostSomething(string someStringParam)
If a certain condition is met, I return the following response:
return BadRequest("you are request sux l0l!!1!");
This response is handled by the error section of either the $http
or Restangular
call:
.error(function(err) {
//display failure notification or perform other action
});
Edit: By "error", I mean the second function in
makeSomeDatabaseCall.then(function(resp){}, function(err){})
Is there a way to verify that the response type was "Bad Request" (or another specified type) and that the message matches exactly with:
"you are request sux l0l!!1!"