how to read Rawrequest using Script Assertion while using URI formats in the request ..
- 8 years ago
Sorry, my mistake! I answered if it were a SOAP request, I believe you have a REST request? If so the messageExchange variable is of class RestResponseMessageExchange, I am not sure why the getRequestContent() method is empty (I'm guessing that it's because there is no "content" to your REST request, all the information is in the actual HTTP request)
The following code:
def rawRequest = new String(messageExchange.getRawRequestData(), "UTF-8") log.info(rawRequest)
Seems to get what you may be after. The getRawRequestData() method returns a byte array, and then we use the String class constructor that takes a byte array argument to convert to a string (Not sure if there is a more "Groovy" way of doing this conversion).
Edit: Just wanted to point out that I have made the assumption that the raw request data is UTF-8 I haven't checked this.