diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-11-14 21:19:38 -0500 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-16 11:44:25 +0800 |
commit | eaec5a878007324cf996edc39ecf3339bfd23e7a (patch) | |
tree | 392edbdcf4ffd49ca0163ecec3bc47a240eafba5 /src | |
parent | 975f75d81ea4b41b634f2c5f167082904ed7f368 (diff) |
Support uploading data from fetch()
Does not yet support streaming, only strings and TypedArrays for now.
Diffstat (limited to 'src')
-rw-r--r-- | src/ops.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ops.rs b/src/ops.rs index d920d25cb..0e2c7e119 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -386,7 +386,6 @@ fn op_fetch( base: &msg::Base, data: &'static mut [u8], ) -> Box<Op> { - assert_eq!(data.len(), 0); let inner = base.inner_as_fetch().unwrap(); let cmd_id = base.cmd_id(); @@ -394,7 +393,12 @@ fn op_fetch( assert!(header.is_request()); let url = header.url().unwrap(); - let body = hyper::Body::empty(); + let body = if data.len() == 0 { + hyper::Body::empty() + } else { + hyper::Body::from(Vec::from(data)) + }; + let req = msg_util::deserialize_request(header, body); if let Err(e) = state.check_net(url) { |