def httpClient = HttpClientBuilder
.create()
.build()
def response = httpClient
.get()
.url("http://example.com/api")
.execute()
def response = httpClient
.post()
.url("http://example.com/api")
.body("data")
.execute()
httpClient
.get()
.url("http://example.com/api")
.executeAsync { response ->
println("Async result: ${response.status}")
}
def httpClient = HttpClientBuilder
.create()
.proxy("http://proxy.example.com", 8080)
.build()
def response = httpClient
.get()
.url("http://example.com/api")
.execute()
println("Response status: ${response.status}")
println("Response body: ${response.body}")