入门教程:https://www.w3cschool.cn/groovy/
httpClient groovy使用HTTPBuilder
post请求处理
import groovyx.net.http.HTTPBuilder
def http = new HTTPBuilder('http://twitter.com/statuses/')
http.request( POST ) {
uri.path = 'update.xml'
body = [ status : 'update!' , source : 'httpbuilder' ]
requestContentType = ContentType.URLENC
response.success = { resp ->
println "Tweet response status: ${resp.statusLine}"
assert resp.statusLine.statusCode == 200
}
}