Skip to content

Commit

Permalink
Update BodySpec.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
asr2003 authored Sep 10, 2024
1 parent d2dba72 commit d7131d9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zio-http/jvm/src/test/scala/zio/http/BodySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit d7131d9

Please sign in to comment.