Add `autoUncompress` to _HttpClientResponse
Bug: dartbug.com/36971
Change-Id: I5f35c26f705591330d7e777773d5595e0978d3e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102780
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Todd Volkert <tvolkert@google.com>
diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart
index f0e365d..a70ca82 100644
--- a/sdk/lib/_http/http_impl.dart
+++ b/sdk/lib/_http/http_impl.dart
@@ -292,9 +292,13 @@
// The HttpClientRequest of this response.
final _HttpClientRequest _httpRequest;
+ // Whether this response is configured to auto uncompress.
+ final bool autoUncompress;
+
_HttpClientResponse(
_HttpIncoming _incoming, this._httpRequest, this._httpClient)
- : super(_incoming) {
+ : autoUncompress = _httpClient.autoUncompress,
+ super(_incoming) {
// Set uri for potential exceptions.
_incoming.uri = _httpRequest.uri;
}
@@ -377,7 +381,7 @@
return new Stream<List<int>>.empty().listen(null, onDone: onDone);
}
Stream<List<int>> stream = _incoming;
- if (_httpClient.autoUncompress &&
+ if (autoUncompress &&
headers.value(HttpHeaders.contentEncodingHeader) == "gzip") {
stream = stream.transform(gzip.decoder);
}