summaryrefslogtreecommitdiff
path: root/ext/http/lib.rs
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-10-05 22:38:27 +0200
committerGitHub <noreply@github.com>2021-10-05 22:38:27 +0200
commit77a00ce1fb4ae2523e22b9b84ae09a0200502e38 (patch)
tree0027a2ff3dbff1e2b0c3afa7ce0f0e54805c7d62 /ext/http/lib.rs
parentd67e85850688117e116bbf7054e80f30fe07afe6 (diff)
chore: various op cleanup (#12329)
Diffstat (limited to 'ext/http/lib.rs')
-rw-r--r--ext/http/lib.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/ext/http/lib.rs b/ext/http/lib.rs
index f1b0c911a..a4e908537 100644
--- a/ext/http/lib.rs
+++ b/ext/http/lib.rs
@@ -1,7 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_core::error::bad_resource_id;
-use deno_core::error::null_opbuf;
use deno_core::error::type_error;
use deno_core::error::AnyError;
use deno_core::futures::future::poll_fn;
@@ -513,10 +512,8 @@ async fn op_http_response_close(
async fn op_http_request_read(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- data: Option<ZeroCopyBuf>,
+ mut data: ZeroCopyBuf,
) -> Result<usize, AnyError> {
- let mut data = data.ok_or_else(null_opbuf)?;
-
let resource = state
.borrow()
.resource_table
@@ -565,9 +562,8 @@ async fn op_http_request_read(
async fn op_http_response_write(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- data: Option<ZeroCopyBuf>,
+ data: ZeroCopyBuf,
) -> Result<(), AnyError> {
- let buf = data.ok_or_else(null_opbuf)?;
let resource = state
.borrow()
.resource_table
@@ -580,7 +576,7 @@ async fn op_http_response_write(
let mut body = RcRef::map(&resource, |r| &r.body).borrow_mut().await;
- let mut send_data_fut = body.send_data(Vec::from(&*buf).into()).boxed_local();
+ let mut send_data_fut = body.send_data(data.to_vec().into()).boxed_local();
poll_fn(|cx| {
let r = send_data_fut.poll_unpin(cx).map_err(AnyError::from);