diff options
author | adamw <adam@warski.org> | 2017-07-16 09:59:09 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-16 09:59:09 +0200 |
commit | b1844f09d78e035d85302310e2ba55929cd5fc52 (patch) | |
tree | f1659e57ff863dd81f6935e422d9f9043fc66f40 /core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala | |
parent | 062ab1ac1bd4fa9f4602ae31419c60a7e6d991bf (diff) | |
download | sttp-b1844f09d78e035d85302310e2ba55929cd5fc52.tar.gz sttp-b1844f09d78e035d85302310e2ba55929cd5fc52.tar.bz2 sttp-b1844f09d78e035d85302310e2ba55929cd5fc52.zip |
Streaming tests, comments
Diffstat (limited to 'core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala index 1216a1e..a8099a4 100644 --- a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala +++ b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala @@ -44,9 +44,10 @@ object UriInterpolator { case Array(x) => if (!x.matches("[a-zA-Z0-9+\\.\\-]*")) { - // anything else than the allowed characters in scheme suggest that there is no scheme - // assuming whatever we parsed so far is part of authority, and parsing the rest - // see https://stackoverflow.com/questions/3641722/valid-characters-for-uri-schemes + // anything else than the allowed characters in scheme suggest that + // there is no scheme assuming whatever we parsed so far is part of + // authority, and parsing the rest; see + // https://stackoverflow.com/questions/3641722/valid-characters-for-uri-schemes Authority(Scheme(""), v).parseS(x) } else append(x) } @@ -54,8 +55,8 @@ object UriInterpolator { 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 + // 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) } @@ -314,8 +315,8 @@ object UriInterpolator { private def encode(s: Any): String = { // space is encoded as a +, which is only valid in the query; - // in other contexts, it must be percent-encoded - // see https://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20 + // in other contexts, it must be percent-encoded; see + // https://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20 URLEncoder.encode(String.valueOf(s), "UTF-8").replaceAll("\\+", "%20") } |