In this case, you want to fold over the params
map, applying a function to each key/value pair that also takes the result of calling that function on the previous key/value pair.
val request = params.foldLeft(url(urlToPut).PUT) { case (req, (k, v)) =>
req.addParameter(k, v)
}
Http(request)
params.foldLeft
takes a start value (ur(urlToPut).PUT
) and then passes that into the function defined here (case (req, (k, v)) => ...
). Each key/value pair in the map gets passed into this function with req
taking the value of the previous step (or the start value for the initial step).