HttpClientResponseCompressionState enum Null safety

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")

Constructors

HttpClientResponseCompressionState()
const

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.

HttpClientResponseCompressionState()
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.

HttpClientResponseCompressionState()
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.

HttpClientResponseCompressionState()

Properties

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

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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.
[notCompressed, decompressed, compressed]