Skip to content

Commit e47a35e

Browse files
author
Dag-Inge Aas
committed
fix($http): add support for PATCH short method
Commit 46691c2 removed the short method for PATCH from $http because there were too many unknows. However, angular#5823 schedules PATCH to be re-added for the 1.3.x milestone. This change adds the short method for PATCH back to the $http library, including tests. Closes angular#5823
1 parent 29432ff commit e47a35e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: src/ng/http.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ function $HttpProvider() {
847847
* @param {Object=} config Optional configuration object
848848
* @returns {HttpPromise} Future object
849849
*/
850-
createShortMethods('get', 'delete', 'head', 'jsonp');
850+
createShortMethods('get', 'delete', 'head', 'jsonp', 'patch');
851851

852852
/**
853853
* @ngdoc method

Diff for: test/ng/httpSpec.js

+9
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,15 @@ describe('$http', function() {
873873
$http.head('/url', {headers: {'Custom': 'Header'}});
874874
});
875875

876+
it('should have patch()', function() {
877+
$httpBackend.expect('PATCH', '/url').respond('');
878+
$http.patch('/url');
879+
});
880+
881+
it('patch() should allow config param', function() {
882+
$httpBackend.expect('PATCH', '/url', undefined, checkHeader('Custom', 'Header')).respond('');
883+
$http.patch('/url', {headers: {'Custom': 'Header'}});
884+
});
876885

877886
it('should have post()', function() {
878887
$httpBackend.expect('POST', '/url', 'some-data').respond('');

0 commit comments

Comments
 (0)