mercredi 30 mars 2016

Angular $httpBackend how to mock an error response?

I'm trying to test that my program processes the error messages I get from http requests properly, but I can't figure out how to mock that with $httpBackend. Given the following:

$httpBackend.expectGET(path).respond(400, object);

400 sets response.status, and object sets response.data, but how do I set response.error? The data I need to test isn't in the data field.

Aucun commentaire:

Enregistrer un commentaire