diff options
Diffstat (limited to 'core/src/main/scala/com')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala index 294d6ce..4bc2a0b 100644 --- a/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala +++ b/core/src/main/scala/com/softwaremill/sttp/UriInterpolator.scala @@ -163,19 +163,26 @@ object UriInterpolator { override def parseE(e: Any): UriBuilder = e match { case m: Map[_, _] => - val flattenedMap = m.flatMap { + val flattenedM = m.flatMap { case (_, None) => None case (k, Some(v)) => Some((k, v)) case (k, v) => Some((k, v)) } - val newFragments = flattenedMap.map { + val newFragments = flattenedM.map { case (k, v) => (Some(encode(k, query = true)), Some(encode(v, query = true))) } copy(fs = fs ++ newFragments) case s: Seq[_] => - val newFragments = s.map { + val flattenedS = s.flatMap { + case (_, None) => None + case (k, Some(v)) => Some((k, v)) + case None => None + case Some(k) => Some(k) + case x => Some(x) + } + val newFragments = flattenedS.map { case (k, v) => (Some(encode(k, query = true)), Some(encode(v, query = true))) case x => (Some(encode(x, query = true)), None) |