diff options
author | Valentin Anger <syrupthinker@gryphno.de> | 2020-06-01 20:20:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 14:20:47 -0400 |
commit | becbb56b19e96e4dd72b861217a855fba953d290 (patch) | |
tree | d9e99771c537ef87a4a945f0120775c337ef90aa /cli/ops/fetch.rs | |
parent | 12d741c2fe453625d510313beaa2e1c282784c00 (diff) |
feat(core): Ops can take several zero copy buffers (#4788)
Diffstat (limited to 'cli/ops/fetch.rs')
-rw-r--r-- | cli/ops/fetch.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cli/ops/fetch.rs b/cli/ops/fetch.rs index 927bc5f64..5a646325e 100644 --- a/cli/ops/fetch.rs +++ b/cli/ops/fetch.rs @@ -28,7 +28,7 @@ pub fn op_fetch( isolate_state: &mut CoreIsolateState, state: &State, args: Value, - data: Option<ZeroCopyBuf>, + data: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { let args: FetchArgs = serde_json::from_value(args)?; let url = args.url; @@ -57,8 +57,10 @@ pub fn op_fetch( let mut request = client.request(method, url_); - if let Some(buf) = data { - request = request.body(Vec::from(&*buf)); + match data.len() { + 0 => {} + 1 => request = request.body(Vec::from(&*data[0])), + _ => panic!("Invalid number of arguments"), } for (key, value) in args.headers { |