Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrutiVerma97 committed Mar 9, 2022
1 parent 02c72ff commit 6769251
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions zio-http/src/main/scala/zhttp/http/Http.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.netty.buffer.{ByteBuf, ByteBufUtil}
import io.netty.channel.ChannelHandler
import io.netty.handler.codec.http.HttpHeaderNames
import zhttp.html._
import zhttp.http.HExit.Effect
import zhttp.http.headers.HeaderModifier
import zhttp.service.server.ServerTime
import zhttp.service.{Handler, HttpRuntime, Server}
Expand Down Expand Up @@ -599,8 +600,19 @@ sealed trait Http[-R, +E, -A, +B] extends (A => ZIO[R, Option[E], B]) { self =>

case Combine(self, other) => {
self.execute(a) match {
case HExit.Empty => other.execute(a)
case u => u.asInstanceOf[HExit[R, E, B]]
case HExit.Effect(zio) => {
Effect(
zio.foldM(
{
case Some(error) => ZIO.fail(Option(error.asInstanceOf[E]))
case None => other.execute(a).toZIO
},
b => ZIO.succeed(b.asInstanceOf[B]),
),
)
}
case HExit.Empty => other.execute(a)
case u => u.asInstanceOf[HExit[R, E, B]]
}
}
}
Expand Down

1 comment on commit 6769251

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance Benchmark:

Concurrency: 256
Requests/sec: 956403.38

Please sign in to comment.