From 2a3212a0a333ee4c0640c6b6d63d3c5c34a81c70 Mon Sep 17 00:00:00 2001 From: jankuca Date: Thu, 29 Aug 2013 18:52:30 -0700 Subject: fix($http): allow empty responses to be cached Closes #3809 --- test/ng/httpSpec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ng/httpSpec.js') diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js index 18be5826..7f49ca8c 100644 --- a/test/ng/httpSpec.js +++ b/test/ng/httpSpec.js @@ -896,6 +896,20 @@ describe('$http', function() { }); + it('should allow the cached value to be an empty string', function () { + cache.put('/abc', ''); + + callback.andCallFake(function (response, status, headers) { + expect(response).toBe(''); + expect(status).toBe(200); + }); + + $http({method: 'GET', url: '/abc', cache: cache}).success(callback); + $rootScope.$digest(); + expect(callback).toHaveBeenCalled(); + }); + + it('should default to status code 200 and empty headers if cache contains a non-array element', inject(function($rootScope) { cache.put('/myurl', 'simple response'); -- cgit v1.2.3