Is this the right way to POST x-www-form-urlencoded data using spray client (it works), or is it there a DSL to set POST params?
val raw = "param1=%1$s¶m2=%2$s¶m3=%3$s".format(
URLEncoder.encode(value1, "UTF-8"),
URLEncoder.encode(value2, "UTF-8"),
URLEncoder.encode(value3, "UTF-8")
)
entity = HttpEntity(MediaTypes.`application/x-www-form-urlencoded`, raw))
val pipeline: HttpRequest => Future[MyClass] = (
encode(Gzip)
~> sendReceive
~> decode(Deflate)
~> unmarshal[MyClass]
)
pipeline(request) onComplete {
case Success(myClass) => // ... add shutdown()
case Failure(error) => // ... add shutdown()
}