Forum Discussion

amirse's avatar
amirse
Contributor
6 years ago
Solved

How to get complete RawRequest as shown in ReadyAPI GUI?

Hi, I am using following code to get raw request created in ReadyAPI:  def rawRequest = context.testCase.getTestStepAt(context.getCurrentStepIndex()).getPropertyValue("RawRequest") log.info("raw...
  • Nastya_Khovrina's avatar
    6 years ago

    Hi amirse,

     

    To get the raw request you can use the following script in the Groovy Test Step:

     

    def myRequestStep = testRunner.testCase.getTestStepByName('TestStepName')
    def GetrequestData = new String(myRequestStep.testRequest.messageExchange.rawRequestData)

    or, the following code in the RequestFilter.afterRequest and RequestFilter.filterRequest events:

    byte[] rawRequestData = request.getResponse().getRawRequestData()
    request = new String(rawRequestData)
    log.info(request)