aboutsummaryrefslogtreecommitdiffstats
path: root/test/service/httpSpec.js
diff options
context:
space:
mode:
authorVojta Jina2012-02-25 18:49:54 -0800
committerVojta Jina2012-02-25 18:49:54 -0800
commit5b0d0683584e304db30462f3448d9f090120c444 (patch)
tree2f037aa3a0a911014c1d194472d5e5bd9b3eca77 /test/service/httpSpec.js
parent230f29d0a78a04a6963514da8b1e34cc03e553d0 (diff)
downloadangular.js-5b0d0683584e304db30462f3448d9f090120c444.tar.bz2
fix($http): Do not serialize File object
Diffstat (limited to 'test/service/httpSpec.js')
-rw-r--r--test/service/httpSpec.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/service/httpSpec.js b/test/service/httpSpec.js
index ad376b5f..4c8471d8 100644
--- a/test/service/httpSpec.js
+++ b/test/service/httpSpec.js
@@ -564,6 +564,25 @@ describe('$http', function() {
$httpBackend.expect('POST', '/url', 'string-data').respond('');
$http({method: 'POST', url: '/url', data: 'string-data'});
});
+
+
+ it('should ignore File objects', function() {
+ var file = {
+ some: true,
+ // $httpBackend compares toJson values by default,
+ // we need to be sure it's not serialized into json string
+ test: function(actualValue) {
+ return this === actualValue;
+ }
+ };
+
+ // I'm really sorry for doing this :-D
+ // Unfortunatelly I don't know how to trick toString.apply(obj) comparison
+ spyOn(window, 'isFile').andReturn(true);
+
+ $httpBackend.expect('POST', '/some', file).respond('');
+ $http({method: 'POST', url: '/some', data: file});
+ });
});