import groovy.json.JsonOutput
import groovyx.net.http.ContentType
import groovyx.net.http.RESTClient
RESTClient http = new RESTClient("http://localhost:8080/")
def response = http.get(contentType : ContentType.JSON, path : 'test')
assert response.status == 200
assert response.contentType == ContentType.JSON.toString()
def jsonMap = response.data
println(JsonOutput.toJson(jsonMap))
response返回的data是jsonMap,如要反序列化,可以使用jackson lib
如使用idea作为ide,需要将http-builder加到依赖库里面去。