cancel
Showing results for 
Search instead for 
Did you mean: 

Loop through REST header

Occasional Contributor

Loop through REST header

Hello All,

 

I need to loop through header with various values in REST services. How could i do that. Thanks in advance.

1 REPLY 1
Contributor

Re: Loop through REST header

So, if I unterstand this correctly you have a setup like this:

Project
    - Test Suite
        - Test Case
             - Test Step
                - REST Request

You can add a groovy script somewhere, in this example we add it directly after the REST request.

 

Project
    - Test Suite
        - Test Case
             - Test Step
                - REST Request
                - groovy script

Then you can add a bit of code to loop through the header values:

context.testCase.getTestStepByName("REST Request").getHttpRequest().getParams().each {
	log.info it.key
}

Here I had the values address and sensor, the output generated the same values..