I have the following code using Dispatch 0.11:
def myHttpPut(urlToPut: String, params: Map[String, String]): Future[Response] = {
val req = url(urlToPut).PUT
params.foreach { case (k, v) => req.addParameter(k, v) }
Http(req)
}
This does not work because addParameter does not modify req - instead it produces a new req object with the parameter added (which, in this case, is being thrown away). What's the most elegant way to write this so that I essentially loop over params, calling addParameter with each key/value pair of the map, building up req until I pass it into Http(req)?