我这里有一些问题。我正在尝试模拟我对服务器的一些 http 请求并将其中一些通过!当我调用 passThroughth() 时,会抛出一个错误!
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)
这是我的跑步
myAppDev.run(function ($httpBackend) {
$httpBackend.whenGET("view/networks.html").passThrough();
$httpBackend.whenGET('/r/networkInterface').respond(networkInterfaces);
});
我的配置有什么问题?
无论如何,当我调用 response(" with some response") 时,我得到的结果是正确的。即 $httpBackEnd 返回响应中的内容!