-
-
Save raul782/8b726b56827e5dd6d79e441185f257aa to your computer and use it in GitHub Desktop.
scala: pass List/Collection of arguments to Function with argument type (String, String) *, such as play.api.libs.ws.WS.WSRequestHolder.withQueryString()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val argumentList = List("arg1"->"val1", "arg2"->"val2", "arg3"->"val3") | |
// repl> argumentList: List[(String, String)] = List((arg1,val1), (arg2,val2), (arg3,val3)) | |
// from play 2.1 scala api | |
// def withQueryString(parameters: (String, String)*): WSRequestHolder | |
// can't pass List[(String, String)] to function because it expects type (String, String) | |
// unwrap collection (List) with : _* | |
play.api.libs.ws.WS.url("http://localhost").withQueryString(argumentList : _*).get |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment