summaryrefslogtreecommitdiff
path: root/std/http/_io.ts
diff options
context:
space:
mode:
authorlideming <me@yuuza.net>2020-11-19 00:47:47 +0800
committerGitHub <noreply@github.com>2020-11-18 17:47:47 +0100
commit60d9ab08dbcf2b9874206bc8411a25ca44e8118e (patch)
tree6bbce950ce91fad1a58ca15a6c020672ed1d5afa /std/http/_io.ts
parentb6fa6d6aac10e992c37b6df887d6f1311356b430 (diff)
fix(std/http): fix error handling in the request iterator (#8365)
If the request body is using chunked encoding, errors may be thrown in "request.finalize()". In this case, we should untrack and close the connection.
Diffstat (limited to 'std/http/_io.ts')
-rw-r--r--std/http/_io.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/std/http/_io.ts b/std/http/_io.ts
index 1b6383acc..b7efaf8e5 100644
--- a/std/http/_io.ts
+++ b/std/http/_io.ts
@@ -69,7 +69,7 @@ export function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader {
const [chunkSizeString] = line.split(";");
const chunkSize = parseInt(chunkSizeString, 16);
if (Number.isNaN(chunkSize) || chunkSize < 0) {
- throw new Error("Invalid chunk size");
+ throw new Deno.errors.InvalidData("Invalid chunk size");
}
if (chunkSize > 0) {
if (chunkSize > buf.byteLength) {