http-builder-ng / gradle-http-plugin

Gradle plugin providing support for using HttpBuilder-NG to make HTTP requests as Gradle Tasks.
https://http-builder-ng.github.io/gradle-http-plugin/
Apache License 2.0
31 stars 8 forks source link

Does not work inside of a doLast block #10

Open lbenedetto opened 5 years ago

lbenedetto commented 5 years ago

I wrote a dead simple post request and tested that it works. Only issue was that it ran every time I synced my project. So I put it inside of a doLast block, and now I get this error message:

A configuration closure or consumer must be provided either globally or by the task configuration

task exportTranslations(group: "crowdin", type: HttpTask) {
    doLast {
        config {
            request.uri = "https://api.crowdin.com/api/project/$PROJECT_IDENTIFIER/export?key=$API_KEY"
        }
        post {
            response.success {
                println("Export successful")
            }
        }
    }
}
cjstehno commented 5 years ago

Thanks. I have flagged it as a bug. You are welcome to provide a fix if you want. :-)

lbenedetto commented 5 years ago

I was able to work around it by using doFirst instead