Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename asString to encode in Scheme #905

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zio-http/src/main/scala/zhttp/http/Scheme.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions zio-http/src/main/scala/zhttp/http/URL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down
2 changes: 1 addition & 1 deletion zio-http/src/main/scala/zhttp/service/Client.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down