mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
fix($http): default json transformation should not crash on angular template
The way we determine whether it's json is lame anyway. We need to change that. We should probably check the content type header...
This commit is contained in:
parent
b9707d910e
commit
92995bbce9
2 changed files with 11 additions and 1 deletions
|
|
@ -61,7 +61,7 @@ function transform(data, fns, param) {
|
|||
* @description
|
||||
*/
|
||||
function $HttpProvider() {
|
||||
var JSON_START = /^\s*[\[\{]/,
|
||||
var JSON_START = /^\s*(\[|\{[^\{])/,
|
||||
JSON_END = /[\}\]]\s*$/,
|
||||
PROTECTION_PREFIX = /^\)\]\}',?\n/;
|
||||
|
||||
|
|
|
|||
|
|
@ -758,6 +758,16 @@ describe('$http', function() {
|
|||
expect(callback).toHaveBeenCalledOnce();
|
||||
expect(callback.mostRecentCall.args[0]).toEqual([1, 'abc', {foo:'bar'}]);
|
||||
});
|
||||
|
||||
|
||||
it('should not deserialize tpl beginning with ng expression', function() {
|
||||
$httpBackend.expect('GET', '/url').respond('{{some}}');
|
||||
$http.get('/url').on('200', callback);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(callback).toHaveBeenCalledOnce();
|
||||
expect(callback.mostRecentCall.args[0]).toEqual('{{some}}');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue