isHtml property

bool get isHtml

Check if response Content-Type is HTML.

Returns true if the response has Content-Type 'text/html'. Useful for testing web pages or HTML responses.

Example:

expect(response.isHtml, true);
expect(response.body.contains('<html>'), true);

Implementation

bool get isHtml {
  final ct = contentType;
  return ct != null && ct.mimeType == 'text/html';
}