diff --git a/modules/http4s-kernel/src/smithy4s/http4s/kernel/package.scala b/modules/http4s-kernel/src/smithy4s/http4s/kernel/package.scala index 690bf24ad..dee0c0424 100644 --- a/modules/http4s-kernel/src/smithy4s/http4s/kernel/package.scala +++ b/modules/http4s-kernel/src/smithy4s/http4s/kernel/package.scala @@ -204,6 +204,8 @@ package object kernel { private def toStream[F[_]]( blob: Blob - ): Stream[F, Byte] = Stream.chunk(Chunk.array(blob.toArray)) + ): Stream[F, Byte] = + // Optimisation motivated by https://github.com/http4s/http4s/issues/7539 + if (blob.isEmpty) Stream.empty else Stream.chunk(Chunk.array(blob.toArray)) }