Skip to content

Commit

Permalink
Simplify the XMLHttpRequest-branch in the fetchData helper functi…
Browse files Browse the repository at this point in the history
…on (PR 17277 follow-up)
  • Loading branch information
Snuffleupagus committed Feb 21, 2024
1 parent 72b8b29 commit 33c5ef3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/display/display_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,21 +435,15 @@ async function fetchData(url, type = "text") {
return;
}
if (request.status === 200 || request.status === 0) {
let data;
switch (type) {
case "arraybuffer":
case "blob":
case "json":
data = request.response;
break;
default:
data = request.responseText;
break;
}
if (data) {
resolve(data);
return;
resolve(request.response);
return;
}
resolve(request.responseText);
return;
}
reject(new Error(request.statusText));
};
Expand Down

0 comments on commit 33c5ef3

Please sign in to comment.