Skip to content

Commit

Permalink
Make fetch async and handle request.text body returning a promise.
Browse files Browse the repository at this point in the history
  • Loading branch information
perkinslr committed Dec 2, 2021
1 parent 0efc78d commit 1e48ba2
Showing 1 changed file with 3 additions and 2 deletions.
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 1e48ba2

Please sign in to comment.