Skip to content

Instantly share code, notes, and snippets.

@Dispader
Created April 7, 2017 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dispader/2dc9b9a9c9bb0af02137a865250266eb to your computer and use it in GitHub Desktop.
Save Dispader/2dc9b9a9c9bb0af02137a865250266eb to your computer and use it in GitHub Desktop.
Self-contained Groovy Console example for using httpbuilder-ng.
@Grab(group='io.github.http-builder-ng', module='http-builder-ng-apache', version='0.15.0')
public class UsedToExposeAnnotationToComplier {}
println 'ok computer'
import groovyx.net.http.HttpBuilder
def httpBin = HttpBuilder.configure {
request.uri = 'http://httpbin.org/'
}
def result = httpBin.get {
request.uri.path = '/get'
}
println "your IP address is: ${result.origin}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment