aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala')
-rw-r--r--core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala21
1 files changed, 11 insertions, 10 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala
index e329630..825985a 100644
--- a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala
+++ b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala
@@ -7,23 +7,24 @@ object UriInterpolator {
private val unreserved = {
val alphanum = (('a' to 'z') ++ ('A' to 'Z') ++ ('0' to '9')).toSet
- val mark = Set('-', '_', '.', '!', '~', '*', '\'', '(', ')')
+ val mark = Set('-', '_', '.', '!', '~', '*', '\'', '(', ')')
alphanum ++ mark
}
def interpolate(sc: StringContext, args: String*): URI = {
- val strings = sc.parts.iterator
+ val strings = sc.parts.iterator
val expressions = args.iterator
- val sb = new StringBuffer(strings.next())
+ val sb = new StringBuffer(strings.next())
- while(strings.hasNext){
- for(c <- expressions.next()){
- if(unreserved(c))
+ while (strings.hasNext) {
+ for (c <- expressions.next()) {
+ if (unreserved(c))
sb.append(c)
- else for(b <- c.toString.getBytes("UTF-8")){
- sb.append("%")
- sb.append("%02X".format(b))
- }
+ else
+ for (b <- c.toString.getBytes("UTF-8")) {
+ sb.append("%")
+ sb.append("%02X".format(b))
+ }
}
sb.append(strings.next())
}