From 67e5a850cc9b37b76638cfbac9dee08286a3469a Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Fri, 13 May 2022 12:53:13 +0200 Subject: feat(serde_v8): bytes::Bytes support (#14412) --- ext/http/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'ext/http/lib.rs') diff --git a/ext/http/lib.rs b/ext/http/lib.rs index e34d4b80f..d1d884457 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -589,10 +589,7 @@ fn http_response( Some(data) => { // If a buffer was passed, but isn't compressible, we use it to // construct a response body. - Ok(( - HttpResponseWriter::Closed, - Bytes::copy_from_slice(&data).into(), - )) + Ok((HttpResponseWriter::Closed, Bytes::from(data).into())) } None if compressing => { // Create a one way pipe that implements tokio's async io traits. To do @@ -766,7 +763,7 @@ async fn op_http_write( } } HttpResponseWriter::BodyUncompressed(body) => { - let bytes = Bytes::copy_from_slice(&buf[..]); + let bytes = Bytes::from(buf); match body.send_data(bytes).await { Ok(_) => Ok(()), Err(err) => { -- cgit v1.2.3