From b43dbc478e1f387c6de60bdab0b99dfbc1de3e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Granstr=C3=B6m?= Date: Sun, 26 Nov 2023 08:47:02 +0100 Subject: [PATCH] fix: multipart header for streaming binary (#2534) * fix: multipart header for streaming binary * chore: fmt --- zio-http/src/main/scala/zio/http/FormField.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zio-http/src/main/scala/zio/http/FormField.scala b/zio-http/src/main/scala/zio/http/FormField.scala index 55e5fc2b7e..b4699c2849 100644 --- a/zio-http/src/main/scala/zio/http/FormField.scala +++ b/zio-http/src/main/scala/zio/http/FormField.scala @@ -188,7 +188,7 @@ object FormField { private[http] def getContentType(ast: Chunk[FormAST]): MediaType = ast.collectFirst { - case header: FormAST.Header if header.name == "Content-Type" => + case header: FormAST.Header if header.name.equalsIgnoreCase("Content-Type") => MediaType .forContentType(header.value) .getOrElse(MediaType.application.`octet-stream`) // Unknown content type defaults to binary @@ -200,13 +200,13 @@ object FormField { )(implicit trace: Trace): ZIO[Any, FormDecodingError, FormField] = { val extract = ast.foldLeft((Option.empty[FormAST.Header], Option.empty[FormAST.Header], Option.empty[FormAST.Header])) { - case (accum, header: FormAST.Header) if header.name == "Content-Disposition" => + case (accum, header: FormAST.Header) if header.name.equalsIgnoreCase("Content-Disposition") => (Some(header), accum._2, accum._3) - case (accum, header: FormAST.Header) if header.name == "Content-Type" => + case (accum, header: FormAST.Header) if header.name.equalsIgnoreCase("Content-Type") => (accum._1, Some(header), accum._3) - case (accum, header: FormAST.Header) if header.name == "Content-Transfer-Encoding" => + case (accum, header: FormAST.Header) if header.name.equalsIgnoreCase("Content-Transfer-Encoding") => (accum._1, accum._2, Some(header)) - case (accum, _) => accum + case (accum, _) => accum } for {