Ask a Question

Response get Header

SOLVED
NicoF
Occasional Visitor

Response get Header

Hi everyone,

 

Is there a way to get the header-data(raw) from response in a teststep? I want to extract informations from there and i have no idea.

 

Thanks a lot.

 

regards

Nico

1 ACCEPTED SOLUTION

Accepted Solutions
Lucian
Community Hero

Re: Response get Header

You only need to add an index like:

 

def value = testRunner.testCase.testSteps["Request"].testRequest.response.responseHeaders["param name"][0]

Cheers!



If my answer helped please click on the 'Accept as Solution' button.

View solution in original post

4 REPLIES 4
Armageddonsoft
Contributor

Re: Response get Header

Yep, use responseHeaders["parameter name"] in Groovy, for example:

def value = testRunner.testCase.testSteps["Request"].testRequest.response.responseHeaders["param name"]

 

Of course, you must know the param name but I assume you do

nagoorkj
Contributor

Re: Response get Header

Hi ,

 

Currently it is returning with Square Brackets so is there any other way to read values alone .

eg. [myheadersValues]

i need without [] array brackets

Lucian
Community Hero

Re: Response get Header

You only need to add an index like:

 

def value = testRunner.testCase.testSteps["Request"].testRequest.response.responseHeaders["param name"][0]

Cheers!



If my answer helped please click on the 'Accept as Solution' button.

View solution in original post

nagoorkj
Contributor

Re: Response get Header

Thanks a lot...it working as expected
cancel
Showing results for 
Search instead for 
Did you mean: