Anish
12 years agoOccasional Contributor
Obtaining complete REST URL appended with query params
Hi,
I have created a new REST Service and a Mock service for the same. In the On request script tab, i have defined a groovy script to render the response according to the path of the request. I have a GET request in which i add a query param. eg id="some value" . In the request window, under the tab "RAW" , i can find the query param appended to the request. But when i print it using the groovy script, i dont get the query param in the URL. I use the following to print the path,
mockRequest.getPath()
mockRequest.getHttpRequest().getPathInfo()
But both returned the same URL without the query param.
Using this i was able to get the query param alone,
mockRequest.getHttpRequest().getQueryString()
Is there any method to find the complete URL with the query param and print it?
Regards,
Anish
I have created a new REST Service and a Mock service for the same. In the On request script tab, i have defined a groovy script to render the response according to the path of the request. I have a GET request in which i add a query param. eg id="some value" . In the request window, under the tab "RAW" , i can find the query param appended to the request. But when i print it using the groovy script, i dont get the query param in the URL. I use the following to print the path,
mockRequest.getPath()
mockRequest.getHttpRequest().getPathInfo()
But both returned the same URL without the query param.
Using this i was able to get the query param alone,
mockRequest.getHttpRequest().getQueryString()
Is there any method to find the complete URL with the query param and print it?
Regards,
Anish