summaryrefslogtreecommitdiff
path: root/std/examples/chat/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/examples/chat/server.ts')
-rw-r--r--std/examples/chat/server.ts5
1 files changed, 3 insertions, 2 deletions
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 {