Forum Discussion

koteno4ka's avatar
koteno4ka
Occasional Contributor
10 years ago

empy request transfer

hi all!

i need copy REST GET request to log after rest operation
i try use Properties transfer and script also:

def request= testRunner.testCase.testSteps["startAuth"].testRequest.response.getRequestContent()
log.info request;
answer:


but i got empty value at both variants.
if i try use it vs response - no problem

def response= testRunner.testCase.testSteps["startAuth"].testRequest.response.responseContent;
log.info response;
answer: [i]Tue Jun 10 10:59:01 MSK 2014:INFO:{"isRegistered":true,"mnemonic":"iPhone 5s 10/06/2014 10:16:47","errorCode":0}[/i]


p/s: sorry for my english

1 Reply

  • Cizo89's avatar
    Cizo89
    Frequent Contributor
    Hi,

    since it's a GET REST webservice, you can only retrieve headers and url, right?

    So this script should be enough for you:

    log.info(testRunner.testCase.testSteps["Test"].getHttpRequest().getResponse().getMethod() )
    log.info(testRunner.testCase.testSteps["Test"].getHttpRequest().getResponse().getURL() )
    log.info(testRunner.testCase.testSteps["Test"].getHttpRequest().getResponse().getHttpVersion() )
    log.info(testRunner.testCase.testSteps["Test"].getHttpRequest().getResponse().getRequestHeaders())


    Regards,
    Marek