1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -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 Bartek Iwańczuk
parent 183305c05e
commit 2df72a6e54
No known key found for this signature in database
GPG key ID: 0C6BCDDC3B3AD750

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 =