Skip to content

Commit

Permalink
Merge pull request #3237 from perkinslr/xmlhttp-request
Browse files Browse the repository at this point in the history
Fix XMLHttpRequest issues
  • Loading branch information
Phergus authored Dec 4, 2021
2 parents 21a338a + 1e48ba2 commit a73bf1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static CompletableFuture<String> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class XMLHttpRequest {
}


function fetch(target, optionObject) {
async function fetch(target, optionObject) {
let request;
if (target instanceof Request) {
request = target;
Expand All @@ -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;
Expand Down

0 comments on commit a73bf1c

Please sign in to comment.