How can I use regular expression to caught up urls in angularjs mocks?

134 Views Asked by At

I need to do something like that

  $httpBackend.whenGET('http://url:port/whatever').passThrough();

Till now, all the requests I were using were with this pattern

  $httpBackend.whenGET('myroute/whatever.html').passThrough();

However, I suppose I have to use now a regex starting with /regex/ but I have no idea how to caught up urls

Any help would be really appreciated, thanks in advance

1

There are 1 best solutions below

0
On

I believe you can use regex or a function:

Try this:

$httpBackend.when("GET", /\/(.*)/)

or

$httpBackend.when("GET", function(url) {
    return true
})