Skip to content

Commit e1d6178

Browse files
Dave Smithcaitp
Dave Smith
authored andcommitted
fix($httpBackend): Add missing expectHEAD() method
This was documented but not implemented. With accompanying unit test to ensure the $httpBackend.expect*() methods exist. Closes angular#7320
1 parent 3fb2d2a commit e1d6178

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/ngMock/angular-mocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
15201520

15211521

15221522
function createShortMethods(prefix) {
1523-
angular.forEach(['GET', 'DELETE', 'JSONP'], function(method) {
1523+
angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) {
15241524
$httpBackend[prefix + method] = function(url, headers) {
15251525
return $httpBackend[prefix](method, url, undefined, headers);
15261526
};

test/ngMock/angular-mocksSpec.js

+8
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,14 @@ describe('ngMock', function() {
929929
hb = $httpBackend;
930930
}));
931931

932+
it('should provide "expect" methods for each HTTP verb', function() {
933+
expect(typeof hb.expectGET).toBe("function");
934+
expect(typeof hb.expectPOST).toBe("function");
935+
expect(typeof hb.expectPUT).toBe("function");
936+
expect(typeof hb.expectPATCH).toBe("function");
937+
expect(typeof hb.expectDELETE).toBe("function");
938+
expect(typeof hb.expectHEAD).toBe("function");
939+
});
932940

933941
it('should respond with first matched definition', function() {
934942
hb.when('GET', '/url1').respond(200, 'content', {});

0 commit comments

Comments
 (0)