Skip to content

Commit 4443ac4

Browse files
Added ZClient.requiringConfig, which has consistent types across platforms
1 parent f4eb907 commit 4443ac4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

zio-http/js/src/main/scala/zio/http/ZClientPlatformSpecific.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import zio.http.internal.FetchDriver
77

88
trait ZClientPlatformSpecific {
99

10+
def requiringConfig: ZLayer[ZClient.Config, Throwable, Client] =
11+
live
12+
1013
def customized: ZLayer[Config with ZClient.Driver[Any, Scope, Throwable], Throwable, Client] = {
1114
implicit val trace: Trace = Trace.empty
1215
ZLayer.scoped {
@@ -35,7 +38,7 @@ trait ZClientPlatformSpecific {
3538

3639
def default: ZLayer[Any, Throwable, Client] = {
3740
implicit val trace: Trace = Trace.empty
38-
ZLayer.succeed(Config.default) >>> live
41+
ZLayer.succeed(Config.default) >>> requiringConfig
3942
}
4043

4144
}

zio-http/jvm/src/main/scala/zio/http/ZClientPlatformSpecific.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import zio.http.netty.client.NettyClientDriver
88

99
trait ZClientPlatformSpecific {
1010

11+
def requiringConfig: ZLayer[ZClient.Config, Throwable, Client] = {
12+
implicit val trace: Trace = Trace.empty
13+
(ZLayer.succeed(NettyConfig.defaultWithFastShutdown) ++ DnsResolver.default) >>> live
14+
}
15+
1116
def customized: ZLayer[Config with ClientDriver with DnsResolver, Throwable, Client] = {
1217
implicit val trace: Trace = Trace.empty
1318
ZLayer.scoped {
@@ -41,8 +46,7 @@ trait ZClientPlatformSpecific {
4146

4247
def default: ZLayer[Any, Throwable, Client] = {
4348
implicit val trace: Trace = Trace.empty
44-
(ZLayer.succeed(Config.default) ++ ZLayer.succeed(NettyConfig.defaultWithFastShutdown) ++
45-
DnsResolver.default) >>> live
49+
ZLayer.succeed(Config.default) >>> requiringConfig
4650
}
4751

4852
}

0 commit comments

Comments
 (0)