Reputation: 95
The post request code that I use:
def http = new HTTPBuilder(uri)
http.request(Method.POST, ContentType.TEXT){
send ContentType.URLENC, attrs
..Response handler code...
}
here attrs is a map with the key&value that needs to be passed such as:
[param1:'value1', param2:'value2', param3:'value3]
I need to support passing multiple values for the same parameter, hence passing as a map is not an option. What is my alternative in this case? What I need to pass:
[param1:'value1', param1:'value2', param3:'value3']
Upvotes: 1
Views: 1567
Reputation: 171084
You should be able to do:
send URLENC, [param1:['value1','value2'], param3:'value3']
Your example won't work as a map can't have multiple keys with the same name
Upvotes: 2