use body when Request instance is passed to fetch (fixes #2433) (#2435)

This commit is contained in:
Kurt Mackey 2019-05-31 14:00:37 -07:00 committed by Ryan Dahl
parent 8fb44eba5b
commit 652be19041
2 changed files with 5 additions and 3 deletions

View file

@ -403,6 +403,11 @@ export async function fetch(
url = input.url;
method = input.method;
headers = input.headers;
//@ts-ignore
if (input._bodySource) {
body = new DataView(await input.arrayBuffer());
}
}
// Send Fetch message

View file

@ -99,7 +99,6 @@ testPerm({ net: true }, async function fetchInitStringBody(): Promise<void> {
assert(response.headers.get("content-type").startsWith("text/plain"));
});
/* TODO(ry) Re-enable this test.
testPerm({ net: true }, async function fetchRequestInitStringBody(): Promise<
void
> {
@ -111,9 +110,7 @@ testPerm({ net: true }, async function fetchRequestInitStringBody(): Promise<
const response = await fetch(req);
const text = await response.text();
assertEquals(text, data);
assert(response.headers.get("content-type").startsWith("text/plain"));
});
*/
testPerm({ net: true }, async function fetchInitTypedArrayBody(): Promise<
void