diff --git a/node_modules/react-native/Libraries/Network/XMLHttpRequest.js b/node_modules/react-native/Libraries/Network/XMLHttpRequest.js index e6191b1..d2d2ca1 100644 --- a/node_modules/react-native/Libraries/Network/XMLHttpRequest.js +++ b/node_modules/react-native/Libraries/Network/XMLHttpRequest.js @@ -130,7 +130,7 @@ class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { _aborted: boolean = false; _cachedResponse: Response; - _hasError: boolean = false; + _error: ?string = null; _headers: Object; _lowerCaseResponseHeaders: Object; _method: ?string = null; @@ -162,7 +162,7 @@ class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { this._requestId = null; this._cachedResponse = undefined; - this._hasError = false; + this._error = null; this._headers = {}; this._response = ''; this._responseType = ''; @@ -222,7 +222,7 @@ class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { get response(): Response { const {responseType} = this; if (responseType === '' || responseType === 'text') { - return this.readyState < LOADING || this._hasError ? '' : this._response; + return this.readyState < LOADING || this._error != null ? '' : this._response; } if (this.readyState !== DONE) { @@ -385,7 +385,7 @@ class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { if (this._responseType === '' || this._responseType === 'text') { this._response = error; } - this._hasError = true; + this._error = error; if (timeOutError) { this._timedOut = true; } @@ -638,11 +638,11 @@ class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { if (newState === this.DONE) { if (this._aborted) { this.dispatchEvent({type: 'abort'}); - } else if (this._hasError) { + } else if (this._error != null) { if (this._timedOut) { this.dispatchEvent({type: 'timeout'}); } else { - this.dispatchEvent({type: 'error'}); + this.dispatchEvent({type: 'error', detail: this._error}); } } else { this.dispatchEvent({type: 'load'});