fix($http): allow multiple json vulnerability prefixes

We strip out both:
)]}',
)]}'
This commit is contained in:
Vojta Jina
2011-10-18 17:03:48 -07:00
committed by Igor Minar
parent fdcc2dbfd3
commit fe633dd0cf
2 changed files with 12 additions and 1 deletions

View File

@@ -743,6 +743,16 @@ describe('$http', function() {
expect(callback).toHaveBeenCalledOnce();
expect(callback.mostRecentCall.args[0]).toEqual([1, 'abc', {foo:'bar'}]);
});
it('should deserialize json with security prefix ")]}\'"', function() {
$httpBackend.expect('GET', '/url').respond(')]}\'\n\n[1, "abc", {"foo":"bar"}]');
$http({method: 'GET', url: '/url'}).on('200', callback);
$httpBackend.flush();
expect(callback).toHaveBeenCalledOnce();
expect(callback.mostRecentCall.args[0]).toEqual([1, 'abc', {foo:'bar'}]);
});
});