Spaces:
Running
Running
Commit
·
ddc2532
1
Parent(s):
3ce1c06
Update index.html
Browse files- index.html +6 -9
index.html
CHANGED
@@ -58,19 +58,16 @@
|
|
58 |
const xhr = new XMLHttpRequest();
|
59 |
|
60 |
xhr.open(init.method, url);
|
61 |
-
|
62 |
for (let header in init.headers) {
|
63 |
xhr.setRequestHeader(header, init.headers[header]);
|
64 |
}
|
65 |
-
|
66 |
xhr.onload = () => {
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
text: () => Promise.resolve(xhr.responseText),
|
72 |
-
json: () => Promise.resolve(JSON.parse(xhr.responseText))
|
73 |
-
});
|
74 |
};
|
75 |
|
76 |
xhr.onerror = () => reject(new TypeError('Network request failed'));
|
|
|
58 |
const xhr = new XMLHttpRequest();
|
59 |
|
60 |
xhr.open(init.method, url);
|
61 |
+
|
62 |
for (let header in init.headers) {
|
63 |
xhr.setRequestHeader(header, init.headers[header]);
|
64 |
}
|
65 |
+
|
66 |
xhr.onload = () => {
|
67 |
+
const init = { "status" : xhr.status , "statusText" : xhr.statusText };
|
68 |
+
const blob = new Blob([xhr.response], {type : 'text/plain'});
|
69 |
+
const response = new Response(blob, init);
|
70 |
+
resolve(response);
|
|
|
|
|
|
|
71 |
};
|
72 |
|
73 |
xhr.onerror = () => reject(new TypeError('Network request failed'));
|