Ask a Question

How to change the HTTP verb (Post-GET vice versa) during runtime using groovy script

apartamsetti
New Contributor

How to change the HTTP verb (Post-GET vice versa) during runtime using groovy script

How to change the verb during runtime like Rest API definition will be post and using groovy script if i want to change to GET or any other verb..is it possible? Can any one please suggest/guide.

4 REPLIES 4
JoostDG
Frequent Contributor

Hi @apartamsetti .

I don't really see/understand the use case to do that... You want to: Given a certain condition execute either a POST or a GET?

Can't you then not define those POST & GET methods in your ReadyAPI "APIs" section and then in your test case perhaps use a script to execute "given condition X run test step "POST" else run test step "GET" "? 

nmrao
Champion Level 3

I echo the same thoughts as @JoostDG .

 

Here is groovy way to send the REST requests using this groovy-ws-lite library

https://github.com/jwagenleitner/groovy-wslite

Please explore.



Regards,
Rao.

Actually i defined Post Endpoint in API's and in the test case if i want to modify the verb to GET using groovy script is it possible? This is my one of my test scenario. Not sure i think it may not be possible to change the defined verb. 

Thank you for your reply..

apartamsetti
New Contributor

Thank you definitely i will go explore it.

cancel
Showing results for 
Search instead for 
Did you mean: