I'm trying to use ng-mock to fake a DELETE request but keep getting Error: Unexpected request: DELETE /api/1.0/package/1. How do I properly define the mock url to match the factory request:
function deletePackage(file) {
return $http.delete('/api/1.0/package/' + file.id)
.then(deleteComplete)
.catch(deleteFailed)
}
$httpBackend.whenDELETE('/api/1.0/package/:id').respond(function(method, url, data, headers, params) {
return [200, params.id];
});
So presumably you know what
file
argument you're going to pass to thedeletePackage
method. With that in mind, you should then know exactly what URI to expect.