resolveContentEncoding function

APIContentEncoding? resolveContentEncoding(
  1. String? value,
  2. List<APIContentEncoding> available
)

Resolves the best APIContentEncoding in available for the Accept-Encoding header value: the one with the highest q value. On a tie, the first one in available wins.

Returns null if none is accepted (the response should not be compressed).

Implementation

APIContentEncoding? resolveContentEncoding(
  String? value,
  List<APIContentEncoding> available,
) {
  if (available.isEmpty) return null;
  return resolveContentEncodingFrom(parseAcceptEncoding(value), available);
}