groovy @Grab('org.codehaus.groovy.modules.http-builder:http-builder:latest.release') import groovyx.net.http.HttpBuilder def http = new HttpBuilder('http://api.example.com') def response = http.request(GET) { uri.path = '/users' requestContentType = ContentType.JSON response.success = { resp, json -> println "Success: ${resp.statusLine}" println json } response.failure = { resp, json -> println "Failure: ${resp.statusLine}" println json } }


上一篇:
下一篇:
切换中文