Forum Discussion

vijayatamma's avatar
vijayatamma
New Contributor
8 years ago

How to get Request Headers and request content in the handler after it is prepared and before submit

Hi

 

I am using ReadyAPI and creating a REST request with some header values initially, but once the request is prepared with the inital values I need to interfere the request and need to modify some header values with the request data that gets prepared for submit.

I need the request header information and request content info once it is preapared so that I can modify it before submit.

 

Can anyone please let me know how can I do it and which handler to use ?

 

Thanks

Vijay

2 Replies

    • vijayatamma's avatar
      vijayatamma
      New Contributor

      Hi

       

      Thanks a lot for your reply.

       

      I want to know how we can get the request headers that gets prepared( as they will be shown in the raw request) inside a Event handler and I am trying to get them like below but no success.

       

      In the RequestFilter.filterRequest or RequestFilter.afterRequest I have tried the following statments

       

      request.getRequestHeaders()

      request.requestHeaders

      context.testCase.testSteps['TestStepname'].httpRequest.requestHeaders

       

      All the above are returning nothing.

       

      Can you please let me know how to do inside the Event and which handler is the correct one to use ?

       

      Thanks

      Vijay