Skip to content

Commit

Permalink
issue_2212 incorporate the review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rajcspsg committed Aug 30, 2023
1 parent 2ff764a commit 6c3bd2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion zio-http/src/main/scala/zio/http/ZClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ object ZClient {
)(implicit trace: Trace): ZIO[Scope, Throwable, Response] = {
val request = Request(version, method, url, headers, body, None)
val cfg = config.copy(ssl = sslConfig.orElse(config.ssl), proxy = proxy.orElse(config.proxy))
requestAsync(request, cfg, () => WebSocketApp.unit, None)
requestAsync(request, cfg, () => WebSocketApp.unit, None)
}

def socket[Env1](
Expand Down
10 changes: 5 additions & 5 deletions zio-http/src/test/scala/zio/http/ClientProxySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import zio.test.TestAspect.{sequential, timeout, withLiveClock}
import zio.test._
import zio.{Scope, Trace, ZIO, ZLayer, durationInt}

import zio.http.internal.{DynamicServer, HttpRunnableSpec, serverTestLayer}
import zio.http.ZClient.{Config, DriverLive}
import zio.http.internal.{DynamicServer, HttpRunnableSpec, serverTestLayer}
import zio.http.netty.NettyConfig
import zio.http.netty.client.NettyClientDriver

Expand Down Expand Up @@ -57,7 +57,7 @@ object ClientProxySpec extends HttpRunnableSpec {
url <- ZIO.fromEither(URL.decode(s"http://localhost:$port"))
id <- DynamicServer.deploy(Handler.ok.toHttpApp)
proxy = Proxy.empty.url(url).headers(Headers(DynamicServer.APP_ID, id))
zclient <- ZIO.serviceWith[Client](_.copy(proxy = Some(proxy)))
zclient <- ZIO.serviceWith[Client](_.proxy(proxy))
out <- zclient
.request(
Request.get(url = url),
Expand All @@ -67,7 +67,9 @@ object ClientProxySpec extends HttpRunnableSpec {
)
} yield out
assertZIO(res.either)(isRight)
},
}.provideSome[DynamicServer](
Client.default,
),
test("proxy respond Ok") {
val res =
for {
Expand All @@ -87,7 +89,6 @@ object ClientProxySpec extends HttpRunnableSpec {
ZLayer.succeed(NettyConfig.default),
Scope.default,
)
_ = println(out)
} yield out
assertZIO(res.either)(isRight)
},
Expand Down Expand Up @@ -130,5 +131,4 @@ object ClientProxySpec extends HttpRunnableSpec {
override def spec: Spec[TestEnvironment with Scope, Any] = suite("ClientProxy") {
serve.as(List(clientProxySpec))
}.provideShared(DynamicServer.live, serverTestLayer) @@ sequential @@ withLiveClock
timeout(5 seconds) @@ sequential @@ withLiveClock
}

0 comments on commit 6c3bd2d

Please sign in to comment.