
urldsl.url.UrlStringDecoder.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of url-dsl_sjs1_2.12 Show documentation
Show all versions of url-dsl_sjs1_2.12 Show documentation
A tiny library for parsing and creating urls in a type-safe way
The newest version!
package urldsl.url
import urldsl.vocabulary.{Param, Segment}
trait UrlStringDecoder {
def decode(str: String, encoding: String = "utf-8"): String
def decodePath(path: String): List[Segment] = Segment.fromPath(path).map(_.map(decode(_)))
def decodeParams(queryString: String): Map[String, Param] =
Param
.fromQueryString(queryString)
.map { case (key, value) => key -> value.transform(decode(_)) }
}
object UrlStringDecoder extends DefaultUrlStringDecoder {
val defaultDecoder: UrlStringDecoder = defaultDecoder0
val identityDecoder: UrlStringDecoder = (str: String, _: String) => str
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy