I have some problem here. I am trying to mock some of my http request to the server and pass some of them through ! When I call passThrougth() an Error is thrown !
Error: Unexpected request: GET view/networks.html
No more request expected
at Error (<anonymous>)
at $httpBackend (http://localhost:8080/js/lib/angular-mocks.js:887:9)
at $httpBackend (http://localhost:8080/js/lib/angular-mocks.js:880:11)
at sendReq (http://localhost:8080/js/lib/angular-scenario.js:18264:9)
at $http (http://localhost:8080/js/lib/angular-scenario.js:18055:17)
at Function.$get.$http.(anonymous function) [as get] (http://localhost:8080/js/lib/angular-scenario.js:18198:18)
at $get.$q.when.then.then.next.locals (http://localhost:8080/js/lib/angular-scenario.js:16605:34)
at deferred.promise.then.wrappedCallback (http://localhost:8080/js/lib/angular-scenario.js:16028:59)
at deferred.promise.then.wrappedCallback (http://localhost:8080/js/lib/angular-scenario.js:16028:59)
at ref.then (http://localhost:8080/js/lib/angular-scenario.js:16065:26)
here is my run
myAppDev.run(function ($httpBackend) {
$httpBackend.whenGET("view/networks.html").passThrough();
$httpBackend.whenGET('/r/networkInterface').respond(networkInterfaces);
});
What is the problem with my config ?
Any way, When I call response(" with some response "), I get results right. i.e the $httpBackEnd returns what is put in response !
Ok guys, after a long and hard fight the problem was very simple to solve.
1- Update to angularJS 1.0.5
2- in my tests I had this line of code
myAppDev.config(function ($provide) {
$provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
});
When I removed this line of code everything went perfect. However, this is what Vojta jina used in this fiddle.