Forum Discussion

demus1's avatar
demus1
New Contributor
9 years ago
Solved

Retrieve request content with property subs

Is it possible to use an Event Listener to retrieve the outgoing request details AFTER any property substitutions have been applied.

I need to generate an auth header, the algorithm for which requires the actual body of the request as an argument.

Using a beforeSubmit listener, I have managed to retrieve the request content using

submit.getRequest().getRequestContent() however this still has the property names rather than the actual values contained therein and thus results in a mismatch.

Any ideas?

  • I have solved my own problem, albeit via a clunky workaround

     

    def request = testStep.getTestRequest()
    String requestName = "\${" + request.getName() + "#Request}"
    def requestBody = context.expand( requestName )

     

    By using context.expand(), all embedded property substitutions are applied and it appears to work

1 Reply

  • demus1's avatar
    demus1
    New Contributor

    I have solved my own problem, albeit via a clunky workaround

     

    def request = testStep.getTestRequest()
    String requestName = "\${" + request.getName() + "#Request}"
    def requestBody = context.expand( requestName )

     

    By using context.expand(), all embedded property substitutions are applied and it appears to work