summaryrefslogtreecommitdiff
path: root/std/http/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/http/server.ts')
-rw-r--r--std/http/server.ts13
1 files changed, 2 insertions, 11 deletions
diff --git a/std/http/server.ts b/std/http/server.ts
index 787820a56..faf5da6af 100644
--- a/std/http/server.ts
+++ b/std/http/server.ts
@@ -53,18 +53,9 @@ export class ServerRequest {
private _body: Deno.Reader | null = null;
/**
- * Body of the request.
+ * Body of the request. The easiest way to consume the body is:
*
- * const buf = new Uint8Array(req.contentLength);
- * let bufSlice = buf;
- * let totRead = 0;
- * while (true) {
- * const nread = await req.body.read(bufSlice);
- * if (nread === null) break;
- * totRead += nread;
- * if (totRead >= req.contentLength) break;
- * bufSlice = bufSlice.subarray(nread);
- * }
+ * const buf: Uint8Array = await Deno.readAll(req.body);
*/
get body(): Deno.Reader {
if (!this._body) {