Fix(http): invalidStateError if response body without content (#11786)
Fix(http): invalidStateError if response body without content If the responseType has been specified and other than 'text', responseText throw an InvalidStateError exception See XHR doc => https://xhr.spec.whatwg.org/#the-responsetext-attribute Unit Test to prevent invalidStateError
This commit is contained in:
@ -54,9 +54,8 @@ export class XHRConnection implements Connection {
|
||||
let onLoad = () => {
|
||||
// responseText is the old-school way of retrieving response (supported by IE8 & 9)
|
||||
// response/responseType properties were introduced in ResourceLoader Level2 spec (supported
|
||||
// by
|
||||
// IE10)
|
||||
let body = isPresent(_xhr.response) ? _xhr.response : _xhr.responseText;
|
||||
// by IE10)
|
||||
let body = _xhr.response === undefined ? _xhr.responseText : _xhr.response;
|
||||
// Implicitly strip a potential XSSI prefix.
|
||||
if (isString(body)) body = body.replace(XSSI_PREFIX, '');
|
||||
let headers = Headers.fromResponseHeaderString(_xhr.getAllResponseHeaders());
|
||||
|
Reference in New Issue
Block a user