aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngMock/angular-mocks.js
diff options
context:
space:
mode:
authorsimpulton2012-04-20 01:31:25 -0700
committerIgor Minar2012-04-20 12:32:33 -0700
commite61fd1b43a55496c11c63da7ca2fc05b88d44043 (patch)
tree007761363c98350ea42cda871b73dfb62d49b1a0 /src/ngMock/angular-mocks.js
parentce15a3e0491f7acafcdf0ff07f75d0c2c9819164 (diff)
downloadangular.js-e61fd1b43a55496c11c63da7ca2fc05b88d44043.tar.bz2
feat($resource): support HTTP PATCH method
Properly serialize data into request body instead of url. Closes #887
Diffstat (limited to 'src/ngMock/angular-mocks.js')
-rw-r--r--src/ngMock/angular-mocks.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js
index 0b8f016f..a2d4f88b 100644
--- a/src/ngMock/angular-mocks.js
+++ b/src/ngMock/angular-mocks.js
@@ -1113,6 +1113,20 @@ function createHttpBackendMock($delegate, $browser) {
/**
* @ngdoc method
+ * @name angular.module.ngMock.$httpBackend#expectPATCH
+ * @methodOf angular.module.ngMock.$httpBackend
+ * @description
+ * Creates a new request expectation for PATCH requests. For more info see `expect()`.
+ *
+ * @param {string|RegExp} url HTTP url.
+ * @param {(string|RegExp)=} data HTTP request body.
+ * @param {Object=} headers HTTP headers.
+ * @returns {requestHandler} Returns an object with `respond` method that control how a matched
+ * request is handled.
+ */
+
+ /**
+ * @ngdoc method
* @name angular.module.ngMock.$httpBackend#expectJSONP
* @methodOf angular.module.ngMock.$httpBackend
* @description
@@ -1220,7 +1234,7 @@ function createHttpBackendMock($delegate, $browser) {
}
});
- angular.forEach(['PUT', 'POST'], function(method) {
+ angular.forEach(['PUT', 'POST', 'PATCH'], function(method) {
$httpBackend[prefix + method] = function(url, data, headers) {
return $httpBackend[prefix](method, url, data, headers)
}
@@ -1485,6 +1499,20 @@ angular.module('ngMockE2E', ['ng']).config(function($provide) {
/**
* @ngdoc method
+ * @name angular.module.ngMockE2E.$httpBackend#whenPATCH
+ * @methodOf angular.module.ngMockE2E.$httpBackend
+ * @description
+ * Creates a new backend definition for PATCH requests. For more info see `when()`.
+ *
+ * @param {string|RegExp} url HTTP url.
+ * @param {(string|RegExp)=} data HTTP request body.
+ * @param {(Object|function(Object))=} headers HTTP headers.
+ * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
+ * control how a matched request is handled.
+ */
+
+/**
+ * @ngdoc method
* @name angular.module.ngMockE2E.$httpBackend#whenJSONP
* @methodOf angular.module.ngMockE2E.$httpBackend
* @description