contentLength property

int contentLength

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

Returns null if the header is invalidly formatted.

Implementation

int get contentLength {
  return int.tryParse(headers['content-length']);
}
void contentLength= (int value)

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

If value is null, then the header will be removed.

Implementation

set contentLength(int value) {
  if (value == null) {
    headers.remove('content-length');
  } else {
    headers['content-length'] = value.toString();
  }
}