[rest-gradle-plugin] 38/83: Refactoring RestTask

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed Oct 25 15:59:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository rest-gradle-plugin.

commit 3530efbafe5841aecc69a31b21ce7e317e0078b3
Author: Andrea Rossi <andrea.rossi at here.com>
Date:   Tue Aug 5 23:04:47 2014 +0200

    Refactoring RestTask
    
    The server response now is saved inside an instance field, so that
    child tasks can use it if needed
    Now the validation of the input is done inside a dedicated method
    Adds an additional check to assure that if you do a GET request you don't
    set a request body
---
 src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
index c519ef8..eef2a7a 100644
--- a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
+++ b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
@@ -15,7 +15,6 @@
  */
 
 package org._10ne.gradle.rest
-
 import groovyx.net.http.HttpResponseDecorator
 import groovyx.net.http.RESTClient
 import org.apache.commons.lang.StringUtils
@@ -25,7 +24,6 @@ import org.gradle.api.InvalidUserDataException
 import org.gradle.api.tasks.Input
 import org.gradle.api.tasks.Optional
 import org.gradle.api.tasks.TaskAction
-
 /**
  * @author Noam Y. Tenne
  */
@@ -50,6 +48,8 @@ class RestTask extends DefaultTask {
     @Input
     @Optional Object requestHeaders
 
+    HttpResponseDecorator serverResponse
+
     RestTask() {
         httpMethod = 'get'
         client = new RESTClient()
@@ -98,8 +98,6 @@ class RestTask extends DefaultTask {
 
         println "Executing a '$httpMethod' request to '$uri'"
 
-        HttpResponseDecorator responseDecorator = client."${httpMethod.toLowerCase()}"(params)
-
-        println "Received response: ${responseDecorator.getData()}"
+        serverResponse = client."${httpMethod.toLowerCase()}"(params)
     }
 }
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/rest-gradle-plugin.git



More information about the pkg-java-commits mailing list