I have an API which has a response header of Keep-Alive
with the following values
Keep-Alive →timeout=15, max=100
I want to assert that the values timeout is at least 10 and at most 100. Earlier I was using Postman BDD library and had this code
let keepAlive = response.getHeader("Keep-Alive");
// Make sure it contains "max=##"
let match = /max=(\d+)/.exec(keepAlive);
expect(match).to.be.an("array").and.not.empty;
// Make sure the max is between 98 and 100
let max = parseInt(match[1]);
expect(max).to.be.at.least(15).and.at.most(100);
However, if I use Chakram
, the getHeader
function errors out with TypeError: response.getHeader is not a function
. Does anyone has any idea how to get a header value using Chakram.