From c2588b7db541f5b0a16be2c2c7b03aebed5a0ab1 Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 16 Jun 2015 15:47:49 +0200 Subject: [PATCH] =htp #17051 fix multipart unmarshaller not surfacing header parsing errors on outer (part) stream --- .../scala/akka/http/impl/engine/parsing/BodyPartParser.scala | 5 +++-- .../http/scaladsl/unmarshalling/MultipartUnmarshallers.scala | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/BodyPartParser.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/BodyPartParser.scala index 7086f937a9..36d874d90a 100644 --- a/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/BodyPartParser.scala +++ b/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/BodyPartParser.scala @@ -260,9 +260,10 @@ private[http] object BodyPartParser { } sealed trait Output - final case class BodyPartStart(headers: List[HttpHeader], createEntity: Source[Output, Unit] ⇒ BodyPartEntity) extends Output + sealed trait PartStart extends Output + final case class BodyPartStart(headers: List[HttpHeader], createEntity: Source[Output, Unit] ⇒ BodyPartEntity) extends PartStart final case class EntityPart(data: ByteString) extends Output - final case class ParseError(info: ErrorInfo) extends Output + final case class ParseError(info: ErrorInfo) extends PartStart final case class Settings( maxHeaderNameLength: Int, diff --git a/akka-http/src/main/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallers.scala b/akka-http/src/main/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallers.scala index e5a6dfe317..802c758008 100644 --- a/akka-http/src/main/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallers.scala +++ b/akka-http/src/main/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallers.scala @@ -88,7 +88,7 @@ trait MultipartUnmarshallers { case _ ⇒ val bodyParts = entity.dataBytes .transform(() ⇒ parser) - .splitWhen(_.isInstanceOf[BodyPartStart]) + .splitWhen(_.isInstanceOf[PartStart]) .via(headAndTailFlow) .collect { case (BodyPartStart(headers, createEntity), entityParts) ⇒ createBodyPart(createEntity(entityParts), headers)