Ask a Question

How to create a virtaction with a generic path

rahuldutta
Occasional Contributor

How to create a virtaction with a generic path

Hi,

I am trying to create a VS from Empty REST. I want to add a virtaction that will take any path for GET or POST or any other operation. 

e.g. My VirtAction will have GET /{Any path}. So, during playback any GET requests will match with that virtaction path.

Please suggest if the tool allows defining generic paths using regexp or anything.

Thanks!

4 REPLIES 4
MConneely
Staff

Hopefully this might help 
Create a new VirtAction, set the method as Get and Resource Path as /{operation}. Include the curly brackets

Set your dispatch style to Sequence and set up a response

so, as below,  when you visit the endpoint (regardless of the value for the operation parameter), you will get the same response
http://localhost:8082/xyz 
http://localhost:8082/efg



 

rahuldutta
Occasional Contributor

Hi,

Tried as you suggested. My VirtAction is GET /{operation} but when I send a request to the virtual service, I am getting a HTTP405 Method not allowed error.

 

Thanks!

In your Response, what is your Http Status Code, Content Type and response value (in the Editor tab)?

https://support.smartbear.com/readyapi/docs/virtualization/configure/create-responses.html 

 

Have you any additional configuration set? Are you seeing anything in error logs?

rahuldutta
Occasional Contributor

Getting a HTTP404 because the URL in the incoming request is not able to match with the Virtaction path. I have a HTTP200 in my dispatch response file. It is not even trying to see what is there in the dispatch settings.

cancel
Showing results for 
Search instead for 
Did you mean: