contentType property

ContentType? get contentType

Get the parsed Content-Type header.

Returns a ContentType object with parsed MIME type and parameters, or null if no Content-Type header is present.

Example:

final ct = response.contentType;
expect(ct?.mimeType, 'application/json');
expect(ct?.charset, 'utf-8');

Implementation

ContentType? get contentType => _response.headers.contentType;