I have an API that responds status 202 with no data, but the response has a header "Location" that points to a URL.
I've looked at the $httpBackend respond(...) documentation and see no mention of how to mock a header in the response.
I've taken a guess that it might be something like this:
var expectedUrl = 'http://...';
var responseConfig = {
headers: {
location: 'http://...'
}
};
$httpBackend.when(expectedUrl).respond(202, '', responseConfig);
In my unit tests, I'm getting expected status 202, but the headers('location') is returning undefined.
Suggestions?
Aucun commentaire:
Enregistrer un commentaire