0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

fix(ext/flash): Fix panic when JS caller doesn't consume request body (#16173)

If the JS handler gets a POST, PUT, or PATCH request, but doesn't
`await` the body, deno would panic because it will try to read the body
even though the request has already been handled.

Not sure how/where to test this case, so I could use some help with
that.
This commit is contained in:
Isaiah Gamble 2023-01-14 23:59:35 -05:00 committed by GitHub
parent 2f15efbb3d
commit 9830ae8297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -754,7 +754,11 @@ async fn op_flash_read_body(
.as_mut()
.unwrap()
};
let tx = ctx.requests.get_mut(&token).unwrap();
let tx = match ctx.requests.get_mut(&token) {
Some(tx) => tx,
// request was already consumed by caller
None => return 0,
};
if tx.te_chunked {
let mut decoder =