how to add query parameter values into a REST resource path through Groovy
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how to add query parameter values into a REST resource path through Groovy
how to add query parameter values into a REST resource path through Groovy
1. Is the below code correct to follow?
import com.eviware.soapui.support.types.StringToStringMap
def headers = new StringToStringMap()
headers.put("include", "value")
testRunner.testCase.getTestStepByName("REST Request").getHttpRequest().setRequestHeaders(headers)
2. Will this apend my resource path to include Query paramtere and is shown as below:
http://10.210.12.122:8080/mjo?include=value
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This results in addition of a new header value - include.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sandeep,
If I understand you right:
1. No, this code can be used to add headers to a request: https://www.screencast.com/t/kK5M8IwRM
2. To add query parameters to a request you can use the RequestFilter.filterRequest event and the following code:
// get method so we can get the complete URI def method = context.getProperty( "httpMethod" ) //log.info( method.URI.toString() ) method.URI = new URI("http://10.210.12.122:8080/mjo?include=value?input=value") context.setProperty( "httpMethod", method ) //log.info( method.URI.toString() )
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
