Add HttpServer:autoCompress option, to disable auto gzip compression. BUG= R=lrn@google.com, sgjesse@google.com Review URL: https://codereview.chromium.org//598453003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40587 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 05f2f2c..f3d79a3 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 1.3.0 + +* Add support for `HttpServer.autoCompress`. + ## 1.2.0 * Add support for `HttpServer.defaultResponseHeaders.clear`.
diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 7075ab4..01e3ca8 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart
@@ -46,6 +46,13 @@ } } + bool get autoCompress => _servers.first.autoCompress; + set autoCompress(bool value) { + for (var server in _servers) { + server.autoCompress = value; + } + } + /// Returns the port that one of the wrapped servers is listening on. /// /// If the wrapped servers are listening on different ports, it's not defined
diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index b1b2830..3d92710 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml
@@ -1,5 +1,5 @@ name: http_multi_server -version: 1.2.0 +version: 1.3.0-dev author: "Dart Team <misc@dartlang.org>" homepage: http://www.dartlang.org description:
diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 0371c89..f74f359 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart
@@ -58,6 +58,27 @@ expect(_get(subServer3).then((response) { expect(response.headers['server'], equals("http_multi_server test")); }), completes); + } + ); + test("autoCompress= sets the value for all servers", () { + multiServer.autoCompress = true; + + multiServer.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + expect(_get(subServer1).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), completes); + + expect(_get(subServer2).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), completes); + + expect(_get(subServer3).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), completes); }); test("headers.set sets the value for all servers", () {