Foreach maravilloso

def generateUrl(SearchRequest searchRequest){
String url = TEST_URL
boolean first = true

searchRequest
.requestParameters.each {key, value ->
if (first)
url
+= Constants.WHAT + key+Constants.EQUALS + value
else
url
+= Constants.AND + key + Constants.EQUALS + value
first
= false
}

println
"SEARCH REQUEST => ${url}"

url

}