@@ -1178,7 +1178,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1178
1178
* Creates a new backend definition.
1179
1179
*
1180
1180
* @param {string } method HTTP method.
1181
- * @param {string|RegExp } url HTTP url.
1181
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1182
+ * and returns true if the url match the current definition.
1182
1183
* @param {(string|RegExp|function(string))= } data HTTP request body or function that receives
1183
1184
* data string and returns true if the data is as expected.
1184
1185
* @param {(Object|function(Object))= } headers HTTP headers or function that receives http header
@@ -1216,7 +1217,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1216
1217
* @description
1217
1218
* Creates a new backend definition for GET requests. For more info see `when()`.
1218
1219
*
1219
- * @param {string|RegExp } url HTTP url.
1220
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1221
+ * and returns true if the url match the current definition.
1220
1222
* @param {(Object|function(Object))= } headers HTTP headers.
1221
1223
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1222
1224
* request is handled.
@@ -1228,7 +1230,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1228
1230
* @description
1229
1231
* Creates a new backend definition for HEAD requests. For more info see `when()`.
1230
1232
*
1231
- * @param {string|RegExp } url HTTP url.
1233
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1234
+ * and returns true if the url match the current definition.
1232
1235
* @param {(Object|function(Object))= } headers HTTP headers.
1233
1236
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1234
1237
* request is handled.
@@ -1240,7 +1243,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1240
1243
* @description
1241
1244
* Creates a new backend definition for DELETE requests. For more info see `when()`.
1242
1245
*
1243
- * @param {string|RegExp } url HTTP url.
1246
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1247
+ * and returns true if the url match the current definition.
1244
1248
* @param {(Object|function(Object))= } headers HTTP headers.
1245
1249
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1246
1250
* request is handled.
@@ -1252,7 +1256,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1252
1256
* @description
1253
1257
* Creates a new backend definition for POST requests. For more info see `when()`.
1254
1258
*
1255
- * @param {string|RegExp } url HTTP url.
1259
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1260
+ * and returns true if the url match the current definition.
1256
1261
* @param {(string|RegExp|function(string))= } data HTTP request body or function that receives
1257
1262
* data string and returns true if the data is as expected.
1258
1263
* @param {(Object|function(Object))= } headers HTTP headers.
@@ -1266,7 +1271,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1266
1271
* @description
1267
1272
* Creates a new backend definition for PUT requests. For more info see `when()`.
1268
1273
*
1269
- * @param {string|RegExp } url HTTP url.
1274
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1275
+ * and returns true if the url match the current definition.
1270
1276
* @param {(string|RegExp|function(string))= } data HTTP request body or function that receives
1271
1277
* data string and returns true if the data is as expected.
1272
1278
* @param {(Object|function(Object))= } headers HTTP headers.
@@ -1280,7 +1286,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1280
1286
* @description
1281
1287
* Creates a new backend definition for JSONP requests. For more info see `when()`.
1282
1288
*
1283
- * @param {string|RegExp } url HTTP url.
1289
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1290
+ * and returns true if the url match the current definition.
1284
1291
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1285
1292
* request is handled.
1286
1293
*/
@@ -1294,7 +1301,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1294
1301
* Creates a new request expectation.
1295
1302
*
1296
1303
* @param {string } method HTTP method.
1297
- * @param {string|RegExp } url HTTP url.
1304
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1305
+ * and returns true if the url match the current definition.
1298
1306
* @param {(string|RegExp|function(string)|Object)= } data HTTP request body or function that
1299
1307
* receives data string and returns true if the data is as expected, or Object if request body
1300
1308
* is in JSON format.
@@ -1326,7 +1334,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1326
1334
* @description
1327
1335
* Creates a new request expectation for GET requests. For more info see `expect()`.
1328
1336
*
1329
- * @param {string|RegExp } url HTTP url.
1337
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1338
+ * and returns true if the url match the current definition.
1330
1339
* @param {Object= } headers HTTP headers.
1331
1340
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1332
1341
* request is handled. See #expect for more info.
@@ -1338,7 +1347,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1338
1347
* @description
1339
1348
* Creates a new request expectation for HEAD requests. For more info see `expect()`.
1340
1349
*
1341
- * @param {string|RegExp } url HTTP url.
1350
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1351
+ * and returns true if the url match the current definition.
1342
1352
* @param {Object= } headers HTTP headers.
1343
1353
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1344
1354
* request is handled.
@@ -1350,7 +1360,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1350
1360
* @description
1351
1361
* Creates a new request expectation for DELETE requests. For more info see `expect()`.
1352
1362
*
1353
- * @param {string|RegExp } url HTTP url.
1363
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1364
+ * and returns true if the url match the current definition.
1354
1365
* @param {Object= } headers HTTP headers.
1355
1366
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1356
1367
* request is handled.
@@ -1362,7 +1373,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1362
1373
* @description
1363
1374
* Creates a new request expectation for POST requests. For more info see `expect()`.
1364
1375
*
1365
- * @param {string|RegExp } url HTTP url.
1376
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1377
+ * and returns true if the url match the current definition.
1366
1378
* @param {(string|RegExp|function(string)|Object)= } data HTTP request body or function that
1367
1379
* receives data string and returns true if the data is as expected, or Object if request body
1368
1380
* is in JSON format.
@@ -1377,7 +1389,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1377
1389
* @description
1378
1390
* Creates a new request expectation for PUT requests. For more info see `expect()`.
1379
1391
*
1380
- * @param {string|RegExp } url HTTP url.
1392
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1393
+ * and returns true if the url match the current definition.
1381
1394
* @param {(string|RegExp|function(string)|Object)= } data HTTP request body or function that
1382
1395
* receives data string and returns true if the data is as expected, or Object if request body
1383
1396
* is in JSON format.
@@ -1392,7 +1405,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1392
1405
* @description
1393
1406
* Creates a new request expectation for PATCH requests. For more info see `expect()`.
1394
1407
*
1395
- * @param {string|RegExp } url HTTP url.
1408
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1409
+ * and returns true if the url match the current definition.
1396
1410
* @param {(string|RegExp|function(string)|Object)= } data HTTP request body or function that
1397
1411
* receives data string and returns true if the data is as expected, or Object if request body
1398
1412
* is in JSON format.
@@ -1407,7 +1421,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1407
1421
* @description
1408
1422
* Creates a new request expectation for JSONP requests. For more info see `expect()`.
1409
1423
*
1410
- * @param {string|RegExp } url HTTP url.
1424
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1425
+ * and returns true if the url match the current definition.
1411
1426
* @returns {requestHandler } Returns an object with `respond` method that control how a matched
1412
1427
* request is handled.
1413
1428
*/
@@ -1531,6 +1546,7 @@ function MockHttpExpectation(method, url, data, headers) {
1531
1546
this . matchUrl = function ( u ) {
1532
1547
if ( ! url ) return true ;
1533
1548
if ( angular . isFunction ( url . test ) ) return url . test ( u ) ;
1549
+ if ( angular . isFunction ( url ) ) return url ( u ) ;
1534
1550
return url == u ;
1535
1551
} ;
1536
1552
@@ -1808,7 +1824,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1808
1824
* Creates a new backend definition.
1809
1825
*
1810
1826
* @param {string } method HTTP method.
1811
- * @param {string|RegExp } url HTTP url.
1827
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1828
+ * and returns true if the url match the current definition.
1812
1829
* @param {(string|RegExp)= } data HTTP request body.
1813
1830
* @param {(Object|function(Object))= } headers HTTP headers or function that receives http header
1814
1831
* object and returns true if the headers match the current definition.
@@ -1832,7 +1849,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1832
1849
* @description
1833
1850
* Creates a new backend definition for GET requests. For more info see `when()`.
1834
1851
*
1835
- * @param {string|RegExp } url HTTP url.
1852
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1853
+ * and returns true if the url match the current definition.
1836
1854
* @param {(Object|function(Object))= } headers HTTP headers.
1837
1855
* @returns {requestHandler } Returns an object with `respond` and `passThrough` methods that
1838
1856
* control how a matched request is handled.
@@ -1845,7 +1863,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1845
1863
* @description
1846
1864
* Creates a new backend definition for HEAD requests. For more info see `when()`.
1847
1865
*
1848
- * @param {string|RegExp } url HTTP url.
1866
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1867
+ * and returns true if the url match the current definition.
1849
1868
* @param {(Object|function(Object))= } headers HTTP headers.
1850
1869
* @returns {requestHandler } Returns an object with `respond` and `passThrough` methods that
1851
1870
* control how a matched request is handled.
@@ -1858,7 +1877,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1858
1877
* @description
1859
1878
* Creates a new backend definition for DELETE requests. For more info see `when()`.
1860
1879
*
1861
- * @param {string|RegExp } url HTTP url.
1880
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1881
+ * and returns true if the url match the current definition.
1862
1882
* @param {(Object|function(Object))= } headers HTTP headers.
1863
1883
* @returns {requestHandler } Returns an object with `respond` and `passThrough` methods that
1864
1884
* control how a matched request is handled.
@@ -1871,7 +1891,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1871
1891
* @description
1872
1892
* Creates a new backend definition for POST requests. For more info see `when()`.
1873
1893
*
1874
- * @param {string|RegExp } url HTTP url.
1894
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1895
+ * and returns true if the url match the current definition.
1875
1896
* @param {(string|RegExp)= } data HTTP request body.
1876
1897
* @param {(Object|function(Object))= } headers HTTP headers.
1877
1898
* @returns {requestHandler } Returns an object with `respond` and `passThrough` methods that
@@ -1885,7 +1906,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1885
1906
* @description
1886
1907
* Creates a new backend definition for PUT requests. For more info see `when()`.
1887
1908
*
1888
- * @param {string|RegExp } url HTTP url.
1909
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1910
+ * and returns true if the url match the current definition.
1889
1911
* @param {(string|RegExp)= } data HTTP request body.
1890
1912
* @param {(Object|function(Object))= } headers HTTP headers.
1891
1913
* @returns {requestHandler } Returns an object with `respond` and `passThrough` methods that
@@ -1899,7 +1921,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1899
1921
* @description
1900
1922
* Creates a new backend definition for PATCH requests. For more info see `when()`.
1901
1923
*
1902
- * @param {string|RegExp } url HTTP url.
1924
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1925
+ * and returns true if the url match the current definition.
1903
1926
* @param {(string|RegExp)= } data HTTP request body.
1904
1927
* @param {(Object|function(Object))= } headers HTTP headers.
1905
1928
* @returns {requestHandler } Returns an object with `respond` and `passThrough` methods that
@@ -1913,7 +1936,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
1913
1936
* @description
1914
1937
* Creates a new backend definition for JSONP requests. For more info see `when()`.
1915
1938
*
1916
- * @param {string|RegExp } url HTTP url.
1939
+ * @param {string|RegExp|function(string) } url HTTP url or function that receives the url
1940
+ * and returns true if the url match the current definition.
1917
1941
* @returns {requestHandler } Returns an object with `respond` and `passThrough` methods that
1918
1942
* control how a matched request is handled.
1919
1943
*/
0 commit comments