skelkar
11 years agoContributor
Need to get all response headers in an array
Hi,
I have a requirement where I want to capture all response headers into an array.
then iterate through this array and check if a desired header is present or not.
for e.g. if requestid header is not present then do some task else perform some other line of code.
I tried below script -
def ReqId[] = testStep.testRequest.response.responseHeaders
for (i=0,i<ReqId.length,i++)
{
expectedheader = ReqId.text()
if (expectedheader =='RequestId')
log.info "requestid header present"
// some line of code
else
log.info "Response does not have requestId header"
}
but it does not work, please advise.
}
I have a requirement where I want to capture all response headers into an array.
then iterate through this array and check if a desired header is present or not.
for e.g. if requestid header is not present then do some task else perform some other line of code.
I tried below script -
def ReqId[] = testStep.testRequest.response.responseHeaders
for (i=0,i<ReqId.length,i++)
{
expectedheader = ReqId.text()
if (expectedheader =='RequestId')
log.info "requestid header present"
// some line of code
else
log.info "Response does not have requestId header"
}
but it does not work, please advise.
}