diff --git a/zio-http/src/main/scala/zhttp/http/Scheme.scala b/zio-http/src/main/scala/zhttp/http/Scheme.scala index 14e348031b..8e6585c851 100644 --- a/zio-http/src/main/scala/zhttp/http/Scheme.scala +++ b/zio-http/src/main/scala/zhttp/http/Scheme.scala @@ -2,7 +2,7 @@ package zhttp.http import io.netty.handler.codec.http.HttpScheme sealed trait Scheme { self => - def asString: String = Scheme.asString(self) + def encode: String = Scheme.asString(self) } object Scheme { def asString(self: Scheme): String = self match { diff --git a/zio-http/src/main/scala/zhttp/http/URL.scala b/zio-http/src/main/scala/zhttp/http/URL.scala index af54863417..0ec7f0e6ed 100644 --- a/zio-http/src/main/scala/zhttp/http/URL.scala +++ b/zio-http/src/main/scala/zhttp/http/URL.scala @@ -95,8 +95,8 @@ object URL { url.kind match { case Location.Relative => path case Location.Absolute(scheme, host, port) => - if (port == 80 || port == 443) s"${scheme.asString}://$host$path" - else s"${scheme.asString}://$host:$port$path" + if (port == 80 || port == 443) s"${scheme.encode}://$host$path" + else s"${scheme.encode}://$host:$port$path" } } diff --git a/zio-http/src/main/scala/zhttp/service/Client.scala b/zio-http/src/main/scala/zhttp/service/Client.scala index fb9afde801..853eab2be2 100644 --- a/zio-http/src/main/scala/zhttp/service/Client.scala +++ b/zio-http/src/main/scala/zhttp/service/Client.scala @@ -47,7 +47,7 @@ final case class Client(rtm: HttpRuntime[Any], cf: JChannelFactory[Channel], el: } val scheme = req.url.kind match { case Location.Relative => "" - case Location.Absolute(scheme, _, _) => scheme.asString + case Location.Absolute(scheme, _, _) => scheme.encode } val init = ClientChannelInitializer(hand, scheme, sslOption)