Reputation: 478
I am trying to capture web service response via Groovy client, I have to check for duplicate header keys in response. I am capturing response headers using messageExchage.responseHeaders(), but since it returns map, It gives me each key only once, even though it is present twice in a response. is there a way to get this in Array or some other data structure ?
Upvotes: 0
Views: 2857
Reputation: 5585
rawResponseAsString = new String( messageExchange.getRawResponseData())
log.info rawResponseAsString
Upvotes: 1
Reputation: 66109
How are you accessing the web service? If you use the groovy HttpBuilder, you can iterate through the headers, duplicates keys included:
new HTTPBuilder('http://webservice/').with {
request(Method.GET) {
uri.path = '/'
response.success = { resp ->
assert resp.status == 200
resp.headers.each {
println "${it.name}: ${it.value}"
}
}
}
}
Upvotes: 3