문제

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']
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top