From 1e48ba2dae7023c2ec8218d28038ec15c0d0bf6b Mon Sep 17 00:00:00 2001 From: Logan Perkins Date: Thu, 2 Dec 2021 13:04:53 -0800 Subject: [PATCH] Make `fetch` async and handle request.text body returning a promise. --- .../maptool/client/html5/javascript/XMLHttpRequest.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/net/rptools/maptool/client/html5/javascript/XMLHttpRequest.js b/src/main/resources/net/rptools/maptool/client/html5/javascript/XMLHttpRequest.js index 5328dfc1c7..15f8ae0325 100644 --- a/src/main/resources/net/rptools/maptool/client/html5/javascript/XMLHttpRequest.js +++ b/src/main/resources/net/rptools/maptool/client/html5/javascript/XMLHttpRequest.js @@ -107,7 +107,7 @@ class XMLHttpRequest { } -function fetch(target, optionObject) { +async function fetch(target, optionObject) { let request; if (target instanceof Request) { request = target; @@ -126,7 +126,8 @@ function fetch(target, optionObject) { for (let header of request.headers) { x.setRequestHeader(header[0], header[1]) } - let body = request.text(); + let body = await request.text(); + let _resolve; let _reject;