Skip to content

Commit

Permalink
fix Port type collision
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-klass committed Nov 25, 2024
1 parent d6d1d3e commit 626eed2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sttp.tapir.server.http4s
import cats.data.NonEmptyList
import cats.effect.{IO, Resource}
import cats.syntax.all._
import com.comcast.ip4s.Port
import com.comcast.ip4s
import org.http4s.ember.server.EmberServerBuilder
import org.http4s.server.websocket.WebSocketBuilder2
import org.http4s.{HttpApp, HttpRoutes}
Expand Down Expand Up @@ -38,9 +38,9 @@ class Http4sTestServerInterpreter extends TestServerInterpreter[IO, Fs2Streams[I

EmberServerBuilder
.default[IO]
.withPort(Port.fromInt(0).get)
.withPort(ip4s.Port.fromInt(0).get)
.withHttpWebSocketApp(service)
.build
.map(s => Port.fromInt(s.address.getPort).get)
.map(_.address.getPort)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cats.data.NonEmptyList
import cats.effect.{IO, Resource}
import cats._
import cats.syntax.all._
import com.comcast.ip4s.Port
import com.comcast.ip4s
import org.http4s.ember.server.EmberServerBuilder
import org.http4s.server.websocket.WebSocketBuilder2
import org.http4s.{HttpApp, HttpRoutes}
Expand Down Expand Up @@ -44,10 +44,10 @@ class ZHttp4sTestServerInterpreter extends TestServerInterpreter[Task, ZioStream

EmberServerBuilder
.default[Task]
.withPort(Port.fromInt(0).get)
.withPort(ip4s.Port.fromInt(0).get)
.withHttpWebSocketApp(service)
.build
.map(s => Port.fromInt(s.address.getPort).get)
.map(_.address.getPort)
.mapK(new ~>[Task, IO] {
// Converting a ZIO effect to an Cats Effect IO effect
def apply[B](fa: Task[B]): IO[B] = IO.fromFuture(Unsafe.unsafe(implicit u => IO(Runtime.default.unsafe.runToFuture(fa))))
Expand Down

0 comments on commit 626eed2

Please sign in to comment.