javascript - AngularJS : $httpBackend mock only some requests -


i use ngmock module mock several requests so:

 $httpbackend.whenget("/accounts").respond([obj]); 

however, seems loading module expects mock requests. if other request other mocked, "unexpected request" error.

how can configure intercepts requests mock explicitly, , passes else through?

you can use regex , passthrough() function built $httpbackend.

beforeeach(inject(function($httpbackend){     $httpbackend.whenget("/accounts").respond([obj]);     //pass else through     $httpbackend.whenget(/^\w+.*/).passthrough(); })); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -