diff --git a/src/main/java/net/rptools/maptool/client/ui/htmlframe/MTXMLHttpRequest.java b/src/main/java/net/rptools/maptool/client/ui/htmlframe/MTXMLHttpRequest.java index 18d81c158c..ab5acd7b3e 100644 --- a/src/main/java/net/rptools/maptool/client/ui/htmlframe/MTXMLHttpRequest.java +++ b/src/main/java/net/rptools/maptool/client/ui/htmlframe/MTXMLHttpRequest.java @@ -56,7 +56,9 @@ public void _getResponseHeaders(JSObject jheaders) { responseHeaders.forEach( (key, value) -> { - jheaders.setMember(key, value); + if (!key.equals(":Status")) { + jheaders.setMember(key, value); + } }); } diff --git a/src/main/java/net/rptools/maptool/model/library/url/RequestHandler.java b/src/main/java/net/rptools/maptool/model/library/url/RequestHandler.java index 66fa2a1e27..8e090ff997 100644 --- a/src/main/java/net/rptools/maptool/model/library/url/RequestHandler.java +++ b/src/main/java/net/rptools/maptool/model/library/url/RequestHandler.java @@ -121,7 +121,7 @@ public static CompletableFuture processRequest( } responseHeaders.put(":Status", "200"); try { - c.complete(new String(stream.readAllBytes(), StandardCharsets.UTF_16)); + c.complete(new String(stream.readAllBytes(), StandardCharsets.UTF_8)); return c; } catch (IOException e) { responseHeaders.put(":Status", "500 Internal Exception"); 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;