Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
15 years ago

using groovy to obtain the GET requrest

Hello,
I have a REST test step and looking at it in the raw view I see

GET http://perf-g.ceidd.net/midgard/6degree ... 7592e4391c HTTP/1.1
Connection: close
Accept-Encoding: gzip,deflate
session: v4q0jQABkMYfCgEq61SXwm1pZGdhcmQgHHquET6_Zva3PCIsHfUgPZ9zPTstyVDQ
User-Agent: Jakarta Commons-HttpClient/3.1
Host: perf-g.ceidd.net


How can I access the GET uri via groovy
http://perf-g.ceidd.net/midgard/6degree ... 7592e4391c

Thanks

Ali
  • Hello,

    It's a little tricky, here is the required Groovy script:


    def request = testRunner.testCase.testSteps['Method 1 - Request 1'].testRequest
    def path = com.eviware.soapui.impl.rest.support.RestUtils.expandPath( request.resource.fullPath, request.params, request )

    def getRequest = request.endpoint + path

    log.info getRequest


    Replace 'Method 1 - Request 1' with the name of your RestRequest. Good luck!

    Regards,
    Dain
    eviware.com