aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/httpSpec.js
diff options
context:
space:
mode:
authorjankuca2013-08-29 18:52:30 -0700
committerIgor Minar2013-09-02 11:47:51 +0200
commit8e48c4ff6abf7083a04cf20312d2b106f4ba5b2c (patch)
tree3b8e90aff3c75365e947faa18a3f6a2077d6e430 /test/ng/httpSpec.js
parent44ad61e56c04f445d059048838d8de3adbc63090 (diff)
downloadangular.js-8e48c4ff6abf7083a04cf20312d2b106f4ba5b2c.tar.bz2
fix($http): allow empty responses to be cached
Closes #3809
Diffstat (limited to 'test/ng/httpSpec.js')
-rw-r--r--test/ng/httpSpec.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js
index ec1cb7f1..d3653a67 100644
--- a/test/ng/httpSpec.js
+++ b/test/ng/httpSpec.js
@@ -1248,6 +1248,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');