Skip to content

Commit

Permalink
Update Body.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
asr2003 authored Sep 10, 2024
1 parent f164c90 commit d2dba72
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions zio-http/shared/src/main/scala/zio/http/Body.scala
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,11 @@ object Body {
form: Form,
)(implicit trace: Trace): UIO[Body] =
form.multipartBytesUUID.map { case (boundary, bytes) =>
val validBoundary = boundary.replaceAll("[^a-zA-Z0-9'()+_,-./:=?]", "-")
StreamBody(
bytes,
knownContentLength = None,
Some(Body.ContentType(MediaType.multipart.`form-data`, Some(boundary))),
Some(Body.ContentType(MediaType.multipart.`form-data`, Some(validBoundary))),
)
}

Expand Down Expand Up @@ -466,7 +467,7 @@ object Body {

override def isEmpty: Boolean = true

override def toString: String = "Body.empty"
override def toString(): String = "Body.empty"

override private[zio] def unsafeAsArray(implicit unsafe: Unsafe): Array[Byte] = Array.empty[Byte]

Expand Down Expand Up @@ -513,7 +514,7 @@ object Body {
override def asStream(implicit trace: Trace): ZStream[Any, Throwable, Byte] =
ZStream.unwrap(asChunk.map(ZStream.fromChunk(_)))

override def toString: String = s"Body.fromChunk($data)"
override def toString(): String = s"Body.fromChunk($data)"

override private[zio] def unsafeAsArray(implicit unsafe: Unsafe): Array[Byte] = data.toArray

Expand All @@ -538,7 +539,7 @@ object Body {
override def asStream(implicit trace: Trace): ZStream[Any, Throwable, Byte] =
ZStream.unwrap(asChunk.map(ZStream.fromChunk(_)))

override def toString: String = s"Body.fromArray($data)"
override def toString(): String = s"Body.fromArray($data)"

override private[zio] def unsafeAsArray(implicit unsafe: Unsafe): Array[Byte] = data

Expand Down

0 comments on commit d2dba72

Please sign in to comment.