From 7267a4d2523a8e80ec43cf673657a9ac0945578c Mon Sep 17 00:00:00 2001 From: Nabil Abdel-Hafeez <7283535+987Nabil@users.noreply.github.com> Date: Fri, 24 Nov 2023 09:39:17 +0100 Subject: [PATCH] Limit Scheme.Custom construction to calling decode --- zio-http/src/main/scala/zio/http/Scheme.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zio-http/src/main/scala/zio/http/Scheme.scala b/zio-http/src/main/scala/zio/http/Scheme.scala index 0336b6eb62..fe3cde5b7c 100644 --- a/zio-http/src/main/scala/zio/http/Scheme.scala +++ b/zio-http/src/main/scala/zio/http/Scheme.scala @@ -77,7 +77,7 @@ object Scheme { case "https" => HTTPS case "ws" => WS case "wss" => WSS - case custom => Custom(custom.toLowerCase) + case custom => new Custom(custom.toLowerCase) {} } } } @@ -94,7 +94,7 @@ object Scheme { * @param scheme * value MUST not be "http" "https" "ws" "wss" */ - final case class Custom(scheme: String) extends Scheme + sealed abstract case class Custom private[http] (scheme: String) extends Scheme def defaultPortForHTTP = 80 def defaultPortForHTTPS = 443