diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala index d00619d..1216a1e 100644 --- a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala +++ b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala @@ -52,7 +52,21 @@ object UriInterpolator { } } - override def parseE(e: Any): UriBuilder = parseE_asEncodedS_skipNone(e) + override def parseE(e: Any): UriBuilder = { + def encodeIfNotInitialEndpoint(s: String) = { + // special case: when this is the first expression, contains a complete schema with :// and nothing is yet parsed + // not escaping the contents + if (v.isEmpty && s.contains("://")) s else encode(s) + } + + e match { + case s: String => parseS(encodeIfNotInitialEndpoint(s)) + case None => this + case null => this + case Some(x) => parseE(x) + case x => parseS(encodeIfNotInitialEndpoint(x.toString)) + } + } private def append(x: String): Scheme = Scheme(v + x) |