diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/FrameEventRenderer.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/FrameEventRenderer.scala index d445ae80a..603be504e 100644 --- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/FrameEventRenderer.scala +++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/FrameEventRenderer.scala @@ -129,6 +129,6 @@ private[http] final class FrameEventRenderer extends GraphStage[FlowShape[FrameE data(maskOffset + 3) = ((mask & 0x000000FF) >> 0).toByte } - ByteString(data) + ByteString.fromArrayUnsafe(data) } } diff --git a/http/src/main/scala/org/apache/pekko/http/scaladsl/marshalling/PredefinedToEntityMarshallers.scala b/http/src/main/scala/org/apache/pekko/http/scaladsl/marshalling/PredefinedToEntityMarshallers.scala index 03d67d068..fee8181fe 100644 --- a/http/src/main/scala/org/apache/pekko/http/scaladsl/marshalling/PredefinedToEntityMarshallers.scala +++ b/http/src/main/scala/org/apache/pekko/http/scaladsl/marshalling/PredefinedToEntityMarshallers.scala @@ -47,7 +47,7 @@ trait PredefinedToEntityMarshallers extends MultipartMarshallers { val byteBuffer = contentType.charset.nioCharset.encode(charBuffer) val array = new Array[Byte](byteBuffer.remaining()) byteBuffer.get(array) - HttpEntity(contentType, array) + HttpEntity(contentType, ByteString.fromArrayUnsafe(array)) } else HttpEntity.Empty implicit val DoneMarshaller: ToEntityMarshaller[pekko.Done] =