Ask a Question

Adding additiona query parameters to the request via ServiceV option “Route Non Virtualized Request"

SOLVED
Vib
Occasional Contributor

Re: Adding additiona query parameters to the request via ServiceV option “Route Non Virtualized Requ

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

AlexKaras
Community Hero

Re: Adding additiona query parameters to the request via ServiceV option “Route Non Virtualized Requ

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.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Vib
Occasional Contributor

Re: Adding additiona query parameters to the request via ServiceV option “Route Non Virtualized Requ

Sure I will update on this thread once I have the solution

Vib
Occasional Contributor

Re: Adding additiona query parameters to the request via ServiceV option “Route Non Virtualized Requ

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

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: