rossoneri rossoneri - 9 days ago 4
AngularJS Question

how to properly write url in httpBackend service in unit tests

I want to mock


I can write full url as string, but i can not uderstend with last part where i define queryExpression:
"('120' != 1 AND '106' != 5)"

Example of request from console that working:


if i past this as string in
$httpBackend.whenGET( '/api/application/datapage?,groupId&queryExpression=(%27120%27+!%3D+1+AND+%27106%27+!%3D+5)&startIndex=0' )

i have Unexpected Error in my unit tests

Error: Unexpected request: GET /api/application/datapage?,groupId&queryExpression=('120'+!%3D+1+AND+'106'+!%3D+5)&startIndex=0

I define that proplem with wrong format of


First case that it is not so urgent to mock full url for request, i can use RegExp in $httpBackend.whenGet service for match parameters without query.

Second is what i asked and resolution is simple, using \ escape character.

So, the result is: