Forum Discussion
Hi Alex,
I tried to execute the same request from ReadyAPI and I see the same behavior as I was seeing from POSTMAN.
The additional parameter is not getting appended while routing the request to LIVE system. Even the transcationlog only shows the parameters which I am passing intially. The additional parameter is not getting appended.
Once again thank you for looking into it.
You can try to set "Route to" value to property expansion and then change it in your script. For example you can set "Route to" is set to ${#MockService#route_endpoint}, and then you can add to your script:
- Vib5 years agoOccasional Contributor
Sure I will update on this thread once I have the solution
- AlexKaras5 years agoChampion Level 3
Hi Vibhash,
If the case is not solved yet, I think it's time to create a Support ticket via the https://support.smartbear.com/message/?prod=ReadyAPI form.
I would appreciate it if you update this thread with the result you will get as I think that our previous actions were correct and we just missed some step.
- Vib5 years agoOccasional Contributor
I was able to move ahead by adding the below event
MockRunListener.beforeRoute and added the below script, the routing is working as expected.
method.setURI(URI.create(method.getURI().toString() + "&enviornment=ENV1"))
Thanks Temil for providing the solution
- Vib5 years agoOccasional Contributor
Thank you for your resoponse.
I changed the option to "Route To" and set the value to property expansion as ${#MockService#route_endpoint}.
However, I am getting 404. Even I tried to just put the value as the complete URL, however, I am seeing 404.
And also the script is not getting invoked when I have set the option as "Conditional"
if (! mockRequest.path.contains('/oauth2'))
return false // do not route the request
mockRequest.queryString += '&env=ENV1'
mockRunner.getMockContext().mockService.setPropertyValue("route_endpoint","https:/HOSTNAME/oauth2?mockRequest.queryString")
log.info 'DEBUG: Modified query string - ' + mockRequest.queryString
return true // route the request