simple-http-request-using-groovy.md

Simple http request using Groovy

Groovy, one of the best programming language available to run on JVM. I use it everyday for my day-to-day scripting needs. Want to quickly fetch contents of a web page, it can be done in a single line!

Mujahid Khaleel 2018-10-13

Groovy, one of the best programming language available to run on JVM. I use it everyday for my day-to-day scripting needs. Want to quickly fetch contents of a web page, it can be done in a single line!

Simple HTTP Get request

println "https://mujahidk.com/".toURL().text

With request headers

println "https://mujahidk.com/".toURL().getText(requestProperties: [
    'X-RequestToken': 'request-token-value'])

Read more

Groovy Documentation URL.getText(java.util.Map)

tags
programmingtipsgroovy