diff --git a/zio-http/jvm/src/test/scala/zio/http/BoundarySpec.scala b/zio-http/jvm/src/test/scala/zio/http/BoundarySpec.scala index 52076598e1..47d92220d5 100644 --- a/zio-http/jvm/src/test/scala/zio/http/BoundarySpec.scala +++ b/zio-http/jvm/src/test/scala/zio/http/BoundarySpec.scala @@ -59,6 +59,17 @@ object BoundarySpec extends ZIOHttpSpec { boundary4.isEmpty, ) }, + suite("randomUUID")( + test("generated boundary is RFC 2046 compliant") { + for { + boundary <- Boundary.randomUUID + } yield assertTrue( + boundary.id.matches("^[a-zA-Z0-9-]+$"), + boundary.id.startsWith("----"), + boundary.id.endsWith("----"), + ) + }, + ), ) val spec = suite("BoundarySpec")( diff --git a/zio-http/shared/src/main/scala/zio/http/Boundary.scala b/zio-http/shared/src/main/scala/zio/http/Boundary.scala index 90993f0059..80577a7f7d 100644 --- a/zio-http/shared/src/main/scala/zio/http/Boundary.scala +++ b/zio-http/shared/src/main/scala/zio/http/Boundary.scala @@ -75,6 +75,6 @@ object Boundary { def randomUUID(implicit trace: Trace): zio.UIO[Boundary] = zio.Random.nextUUID.map { id => - Boundary(s"(((${id.toString()})))") + Boundary(s"----${id.toString}----") } }