setChunkedEncoding method

  1. @override
void setChunkedEncoding(
  1. HttpResponse response,
  2. bool value
)
override

Asking for chunked encoding on an HTTP/1.0 response is ignored, as those clients cannot receive it (see supportsChunkedEncoding); any other failure is thrown.

Implementation

@override
void setChunkedEncoding(HttpResponse response, bool value) {
  try {
    response.headers.chunkedTransferEncoding = value;
  } on HttpException catch (e) {
    // dart:io reports HTTP/1.0 only through this message.
    if (!value || !e.message.contains('HTTP 1.0')) rethrow;
  }
}