@@ -1481,8 +1481,9 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
1481
1481
* ```
1482
1482
* – The respond method takes a set of static data to be returned or a function that can
1483
1483
* return an array containing response status (number), response data (Array|Object|string),
1484
- * response headers (Object), and the text for the status (string). The respond method returns
1485
- * the `requestHandler` object for possible overrides.
1484
+ * response headers (Object), HTTP status text (string), and XMLHttpRequest status (string:
1485
+ * `complete`, `error`, `timeout` or `abort`). The respond method returns the `requestHandler`
1486
+ * object for possible overrides.
1486
1487
*/
1487
1488
$httpBackend . when = function ( method , url , data , headers , keys ) {
1488
1489
@@ -1680,14 +1681,14 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
1680
1681
+ ( optional ? '' : slash )
1681
1682
+ '(?:'
1682
1683
+ ( optional ? slash : '' )
1683
- + ( star && '(.+?)' || '([^/]+)' )
1684
+ + ( star ? '(.+?)' : '([^/? ]+)' )
1684
1685
+ ( optional || '' )
1685
1686
+ ')'
1686
1687
+ ( optional || '' ) ;
1687
1688
} )
1688
1689
. replace ( / ( [ / $ * ] ) / g, '\\$1' ) ;
1689
1690
1690
- ret . regexp = new RegExp ( '^' + url , 'i' ) ;
1691
+ ret . regexp = new RegExp ( '^' + url + '(?:$|\\?)' , 'i' ) ;
1691
1692
return ret ;
1692
1693
}
1693
1694
@@ -1711,14 +1712,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
1711
1712
* order to change how a matched request is handled.
1712
1713
*
1713
1714
* - respond –
1714
- * ```
1715
- * { function([status,] data[, headers, statusText])
1716
- * | function(function(method, url, data, headers, params)}
1717
- * ```
1715
+ * ```js
1716
+ * { function([status,] data[, headers, statusText])
1717
+ * | function(function(method, url, data, headers, params)}
1718
+ * ```
1718
1719
* – The respond method takes a set of static data to be returned or a function that can
1719
1720
* return an array containing response status (number), response data (Array|Object|string),
1720
- * response headers (Object), and the text for the status (string). The respond method returns
1721
- * the `requestHandler` object for possible overrides.
1721
+ * response headers (Object), HTTP status text (string), and XMLHttpRequest status (string:
1722
+ * `complete`, `error`, `timeout` or `abort`). The respond method returns the `requestHandler`
1723
+ * object for possible overrides.
1722
1724
*/
1723
1725
$httpBackend . expect = function ( method , url , data , headers , keys ) {
1724
1726
0 commit comments