header method

String? header(
  1. String name
)

Get the value of a specific response header.

Header names are case-insensitive. Returns the first value if multiple values exist for the same header.

Example:

expect(response.header('content-type'), 'application/json');
expect(response.header('X-RateLimit-Remaining'), '99');

name Header name (case-insensitive). Returns the header value or null if not present.

Implementation

String? header(String name) {
  return _response.headers.value(name.toLowerCase());
}