HttpClientResponseCompressionState enum

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:

  • Can the value of the response's Content-Length HTTP header be trusted?
  • Does the caller need to manually decompress the response's byte stream?

This enum is accessed via the HttpClientResponse.compressionState value.

Inheritance
Annotations
  • @Since("2.4")

Values

notCompressed → const HttpClientResponseCompressionState

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.

decompressed → const HttpClientResponseCompressionState

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.

compressed → const HttpClientResponseCompressionState

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.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<HttpClientResponseCompressionState>
A constant List of the values in this enum, in order of their declaration.