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:
parent
183305c05e
commit
2df72a6e54
1 changed files with 5 additions and 1 deletions
|
@ -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 =
|
||||
|
|
Loading…
Reference in a new issue