Enum that specifies the compression state of the byte stream of an HttpClientResponse.
The values herein allow callers to answer the following questions as they pertain to an HttpClientResponse:
Content-Length
HTTP header be trusted?This enum is accessed via the HttpClientResponse.compressionState value.
The body of the HTTP response contains compressed bytes.
In this state, the value of the Content-Length
HTTP header, if specified (non-negative), should match the number of bytes produced by the response's byte stream.
If the caller wishes to manually uncompress the body of the response, it should consult the value of the Content-Encoding
HTTP header to see what type of compression has been applied. See tools.ietf.org/html/rfc2616#section-14.11 for more information.
const HttpClientResponseCompressionState(2)
The body of the HTTP response was originally compressed, but by virtue of the HttpClient.autoUncompress configuration option, it has been automatically uncompressed.
HTTP headers are not modified, so when a response has been uncompressed in this way, the value of the Content-Length
HTTP header cannot be trusted, as it will contain the compressed content length, whereas the stream of bytes produced by the response will contain uncompressed bytes.
const HttpClientResponseCompressionState(1)
The body of the HTTP response was received and remains in an uncompressed state.
In this state, the value of the Content-Length
HTTP header, if specified (non-negative), should match the number of bytes produced by the response's byte stream.
const HttpClientResponseCompressionState(0)
A constant List of the values in this enum, in order of their declaration.
const List<HttpClientResponseCompressionState>
The integer index of this enum.
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-io/HttpClientResponseCompressionState-class.html