angular-cn/packages/common/http
Alex Rickabaugh 452a7ae88b fix(common): fix XSSI prefix stripping by using JSON.parse always (#18466)
Currently HttpClient sends requests for JSON data with the
XMLHttpRequest.responseType set to 'json'. With this flag, the browser
will attempt to parse the response as JSON, but will return 'null' on
any errors. If the JSON response contains an XSSI-prevention prefix,
this will cause the browser's parsing to fail, which is unrecoverable.

The only compelling reason to use the responseType 'json' is for
performance (especially if the browser offloads JSON parsing to a
separate thread). I'm not aware of any browser which does this currently,
nor of any plans to do so. JSON.parse and responseType 'json' both
end up using the same V8 code path in Chrome to implement the parse.

Thus, this change switches all JSON parsing in HttpClient to use
JSON.parse directly.

Fixes #18396, #18453.

PR Close #18466
2017-08-29 17:18:54 -07:00
..
src fix(common): fix XSSI prefix stripping by using JSON.parse always (#18466) 2017-08-29 17:18:54 -07:00
test fix(common): fix XSSI prefix stripping by using JSON.parse always (#18466) 2017-08-29 17:18:54 -07:00
testing feat: deprecate @angular/http in favor of @angular/common/http (#18906) 2017-08-28 18:46:58 -05:00
index.ts feat(common): new HttpClient API 2017-07-07 12:09:32 -07:00
package.json feat(common): new HttpClient API 2017-07-07 12:09:32 -07:00
public_api.ts fix(common): rename HttpXsrfModule to HttpClientXsrfModule 2017-07-14 12:40:52 -07:00
rollup.config.js fix(common): fix improper packaging for @angular/common/http (#18613) 2017-08-29 17:12:10 -07:00
tsconfig-build.json feat(common): new HttpClient API 2017-07-07 12:09:32 -07:00