Added error handling for non-CORS requests.

This commit is contained in:
n1474335 2017-06-09 14:53:15 +00:00
parent 52426bc1a4
commit 127364e8a4
2 changed files with 5 additions and 1 deletions

View file

@ -126,6 +126,10 @@ const HTTP = {
return fetch(url, config)
.then(r => {
if (r.status === 0 && r.type === "opaque") {
return "Error: Null response. Try setting the connection mode to CORS.";
}
if (showResponseMetadata) {
let headers = "";
for (let pair of r.headers.entries()) {