Skip to content

Commit

Permalink
update to new serialization API
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Sep 30, 2024
1 parent d437efd commit 2c4d387
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use std::{
borrow::Cow,
future::Future,
str::FromStr,
sync::{
Expand Down Expand Up @@ -173,7 +172,7 @@ async fn handle_request(req: Request<Arc<Session>>) -> tide::Result<Response> {
let mut buf = "--boundary\nContent-Type: ".as_bytes().to_vec();
buf.extend_from_slice(sample.encoding().to_string().as_bytes());
buf.extend_from_slice("\n\n".as_bytes());
buf.extend_from_slice(&sample.payload().into::<Cow<[u8]>>());
buf.extend_from_slice(sample.payload().to_bytes().as_ref());

match tokio::time::timeout(
std::time::Duration::new(10, 0),
Expand Down Expand Up @@ -290,6 +289,6 @@ fn redirect(url: &str) -> Response {
fn response_ok(content_type: Mime, payload: &ZBytes) -> Response {
let mut res = Response::new(StatusCode::Ok);
res.set_content_type(content_type);
res.set_body(payload.into::<Cow<[u8]>>().as_ref());
res.set_body(payload.to_bytes().as_ref());
res
}

0 comments on commit 2c4d387

Please sign in to comment.