contentType property

MediaType get contentType
inherited

Gets or sets the content type to send back to a client.

Implementation

MediaType get contentType {
  try {
    return MediaType.parse(headers['content-type']!);
  } catch (_) {
    return MediaType('text', 'plain');
  }
}
  1. @override
set contentType (MediaType value)
override

Gets or sets the content type to send back to a client.

Implementation

@override
set contentType(MediaType value) {
  super.contentType = value;
  if (!_streamInitialized) {
    rawResponse.headers.contentType = ContentType(
      value.type,
      value.subtype,
      parameters: value.parameters,
    );
  }
}