Skip to content

Commit

Permalink
Beter handling of Empty entity in Akka an Pekko BodyListener.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Zakarczemny committed Nov 7, 2024
1 parent c43c795 commit 4fcc0c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AkkaBodyListener(implicit ec: ExecutionContext) extends BodyListener[Futur
override def onComplete(body: AkkaResponseBody)(cb: Try[Unit] => Future[Unit]): Future[AkkaResponseBody] = {
body match {
case ws @ Left(_) => cb(Success(())).map(_ => ws)
case Right(e @ HttpEntity.Empty) =>
case Right(e) if e.isKnownEmpty =>
Future.successful(Right(e)).andThen { case _ => cb(Success(())) }
case Right(e: UniversalEntity) =>
Future.successful(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PekkoBodyListener(implicit ec: ExecutionContext) extends BodyListener[Futu
override def onComplete(body: PekkoResponseBody)(cb: Try[Unit] => Future[Unit]): Future[PekkoResponseBody] = {
body match {
case ws @ Left(_) => cb(Success(())).map(_ => ws)
case Right(e @ HttpEntity.Empty) =>
case Right(e) if e.isKnownEmpty =>
Future.successful(Right(e)).andThen { case _ => cb(Success(())) }
case Right(e: UniversalEntity) =>
Future.successful(
Expand Down

0 comments on commit 4fcc0c8

Please sign in to comment.