The content type of the body of this response.
Defaults to defaultContentType. This response's body will be encoded according to this value. The Content-Type header of the HTTP response will always be set according to this value.
If this value is set directly, then this instance's Content-Type will be that value. If this value is not set, then the headers property is checked for the key 'content-type'. If the key is not present in headers, this property's value is defaultContentType.
If the key is present and the value is a String
, this value is the result of passing the value to ContentType.parse
.
If the key is present and the value is a ContentType
, this property is equal to that value.
Source
ContentType get contentType { if (_contentType != null) { return _contentType; } var inHeaders = _headers[HttpHeaders.CONTENT_TYPE]; if (inHeaders == null) { return defaultContentType; } if (inHeaders is ContentType) { return inHeaders; } return ContentType.parse(inHeaders); }
Source
set contentType(ContentType t) { _contentType = t; }