From d7131d95970ac90b6253a623980880933cf1b449 Mon Sep 17 00:00:00 2001 From: asr2003 <162500856+asr2003@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:01:48 +0530 Subject: [PATCH] Update BodySpec.scala --- zio-http/jvm/src/test/scala/zio/http/BodySpec.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zio-http/jvm/src/test/scala/zio/http/BodySpec.scala b/zio-http/jvm/src/test/scala/zio/http/BodySpec.scala index 8313dd1324..a244f85c44 100644 --- a/zio-http/jvm/src/test/scala/zio/http/BodySpec.scala +++ b/zio-http/jvm/src/test/scala/zio/http/BodySpec.scala @@ -62,5 +62,17 @@ object BodySpec extends ZIOHttpSpec { assertTrue(body.mediaType == Option(MediaType.text.plain)) }, ), + suite("multipart form boundary")( + test("generated boundary is RFC 2046 compliant") { + for { + form <- ZIO.succeed(Form(FormField.simpleField("name", "test-name"))) + body <- Body.fromMultipartFormUUID(form) + boundaryOpt = body.contentType.flatMap(_.boundary) + _ <- zio.logInfo(s"Generated boundary: ${boundaryOpt.getOrElse("No boundary found")}") + + } yield assertTrue(boundaryOpt.isDefined) && + assertTrue(boundaryOpt.get.matches("^[a-zA-Z0-9'()+_,-./:=?]+$")) + }, + ), ) @@ timeout(10 seconds) }