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/curl.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'std/examples/curl.ts') diff --git a/std/examples/curl.ts b/std/examples/curl.ts index 39e917591..44ee66125 100644 --- a/std/examples/curl.ts +++ b/std/examples/curl.ts @@ -1,4 +1,10 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. const url_ = Deno.args[0]; const res = await fetch(url_); -await Deno.copy(Deno.stdout, res.body); + +// TODO(ry) Re-enable streaming in this example. +// Originally we did: await Deno.copy(Deno.stdout, res.body); +// But maybe more JS-y would be: res.pipeTo(Deno.stdout); + +const body = new Uint8Array(await res.arrayBuffer()); +await Deno.stdout.write(body); -- cgit v1.2.3