1

I am using Httpbuilder 0.7.1 and groovy 1.8 to invoke the rest call.

I need to send the mutiple values for the same query parameter but it is not working.

I need to send values as below https:///?action=test&group=grp1&group=grp2

I have tried with the code below and it is working as expected.

Map query = [:]
Map headerMap = [:]

headerMap["Accept"] = 'application/json'
headerMap["Authorization"] = authtoken

def groupsListArray=[]

if (group.contains(",")) {
        def groupsList = group.split(",");
        for ( singlegroup in groupsList) {
            groupsListArray.add(singlegroup.toString())
        }
        query.put("group",groupListArray)
    }
else{
        query.put("group",group)
}

def http = new HTTPBuilder(baseUrl)
  http.request(method) { req ->
                uri.path = path
                uri.query = query
                headerMap.each { key, value ->
                    headers."${key}" = "${value}"   }
            }

Is there any other way, we can send multiple values for the same query parameter with httpbuilder?

kanskr
  • 43
  • 1
  • 5

1 Answers1

0

Okie, the issue has been identified with the REST service and there is no issue with this code.Thanks for the help

kanskr
  • 43
  • 1
  • 5