summaryrefslogtreecommitdiff
path: root/ext/fetch/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/fetch/lib.rs
parentd67e85850688117e116bbf7054e80f30fe07afe6 (diff)
chore: various op cleanup (#12329)
Diffstat (limited to 'ext/fetch/lib.rs')
-rw-r--r--ext/fetch/lib.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs
index dfb1ce059..ae81d126c 100644
--- a/ext/fetch/lib.rs
+++ b/ext/fetch/lib.rs
@@ -1,7 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use data_url::DataUrl;
-use deno_core::error::null_opbuf;
use deno_core::error::type_error;
use deno_core::error::AnyError;
use deno_core::futures::Future;
@@ -341,10 +340,9 @@ pub async fn op_fetch_send(
pub async fn op_fetch_request_write(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- data: Option<ZeroCopyBuf>,
+ data: ZeroCopyBuf,
) -> Result<(), AnyError> {
- let data = data.ok_or_else(null_opbuf)?;
- let buf = Vec::from(&*data);
+ let buf = data.to_vec();
let resource = state
.borrow()
@@ -362,10 +360,8 @@ pub async fn op_fetch_request_write(
pub async fn op_fetch_response_read(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- data: Option<ZeroCopyBuf>,
+ data: ZeroCopyBuf,
) -> Result<usize, AnyError> {
- let data = data.ok_or_else(null_opbuf)?;
-
let resource = state
.borrow()
.resource_table