api-boltAPIBolt

Headers Assertions

Ensure proper metadata and security policies via HTTP Header validation.

Available Matchers

toHaveHeader(key)

Asserts that a specific case-insensitive header payload is present.

ts
ab.expect('Has API Rate Limit').toHaveHeader('x-ratelimit-remaining');

toHaveHeaderValue(key, expectedOrRegex)

Asserts the header matches an exact string or passes a Regular Expression test.

ts
// Exact String Matching
ab.expect('Cors Policy').toHaveHeaderValue('access-control-allow-origin', '*');

// Regex Matching
ab.expect('Valid Cache Time').toHaveHeaderValue('cache-control', /max-age/);

toHaveContentType(typeSubstring)

Shorthand to ensure the Content-Type header natively includes the provided signature.

ts
ab.expect('Returns JSON').toHaveContentType('application/json');