|
@@ -69,13 +69,9 @@
|
|
|
xhrRequest.onerror = event => reject(new Error(event.details));
|
|
xhrRequest.onerror = event => reject(new Error(event.details));
|
|
|
xhrRequest.onreadystatechange = () => {
|
|
xhrRequest.onreadystatechange = () => {
|
|
|
if (xhrRequest.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
|
|
if (xhrRequest.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
|
|
|
- if (xhrRequest.status >= 400) {
|
|
|
|
|
- reject(new Error(xhrRequest.statusText || xhrRequest.status));
|
|
|
|
|
- } else {
|
|
|
|
|
- const headers = {};
|
|
|
|
|
- headers["content-type"] = xhrRequest.getResponseHeader("Content-Type");
|
|
|
|
|
- resolve({ xhrRequest, headers });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const headers = {};
|
|
|
|
|
+ headers["content-type"] = xhrRequest.getResponseHeader("Content-Type");
|
|
|
|
|
+ resolve({ xhrRequest, headers, status: xhrRequest.status });
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
xhrRequest.open("GET", url, true);
|
|
xhrRequest.open("GET", url, true);
|