From 02bc58d83253fd3be61787bb28b6b02e3aa71092 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 10 Apr 2020 09:51:17 -0400 Subject: BREAKING: Make fetch API more web compatible (#4687) - Removes the __fetch namespace from `deno types` - Response.redirect should be a static. - Response.body should not be AsyncIterable. - Disables the deno_proxy benchmark - Makes std/examples/curl.ts buffer the body before printing to stdout --- std/examples/chat/server.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'std/examples/chat/server.ts') diff --git a/std/examples/chat/server.ts b/std/examples/chat/server.ts index eb5b2f7d4..40affbd5f 100644 --- a/std/examples/chat/server.ts +++ b/std/examples/chat/server.ts @@ -35,13 +35,14 @@ listenAndServe({ port: 8080 }, async (req) => { const u = new URL("./index.html", import.meta.url); if (u.protocol.startsWith("http")) { // server launched by deno run http(s)://.../server.ts, - fetch(u.href).then((resp) => { + fetch(u.href).then(async (resp) => { + const body = new Uint8Array(await resp.arrayBuffer()); return req.respond({ status: resp.status, headers: new Headers({ "content-type": "text/html", }), - body: resp.body, + body, }); }); } else { -- cgit v1.2.3