| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // VMOptions= | 5 // VMOptions= |
| 6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
| 7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
| 8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
| 9 | 9 |
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 test('gzip , deflate', true); | 85 test('gzip , deflate', true); |
| 86 test('deflate,gzip', true); | 86 test('deflate,gzip', true); |
| 87 test('deflate, gzip', true); | 87 test('deflate, gzip', true); |
| 88 test('deflate ,gzip', true); | 88 test('deflate ,gzip', true); |
| 89 test('deflate , gzip', true); | 89 test('deflate , gzip', true); |
| 90 test('abc,deflate , gzip,def,,,ghi ,jkl', true); | 90 test('abc,deflate , gzip,def,,,ghi ,jkl', true); |
| 91 test('xgzip', false); | 91 test('xgzip', false); |
| 92 test('gzipx;', false); | 92 test('gzipx;', false); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void testDisableCompressTest() { |
| 96 HttpServer.bind("127.0.0.1", 0).then((server) { |
| 97 server.autoCompress = false; |
| 98 server.listen((request) { |
| 99 Expect.equals('gzip', request.headers.value(HttpHeaders.ACCEPT_ENCODING)); |
| 100 request.response.write("data"); |
| 101 request.response.close(); |
| 102 }); |
| 103 var client = new HttpClient(); |
| 104 client.get("127.0.0.1", server.port, "/") |
| 105 .then((request) => request.close()) |
| 106 .then((response) { |
| 107 Expect.equals(null, |
| 108 response.headers.value(HttpHeaders.CONTENT_ENCODING)); |
| 109 response.listen( |
| 110 (_) {}, |
| 111 onDone: () { |
| 112 server.close(); |
| 113 client.close(); |
| 114 }); |
| 115 }); |
| 116 }); |
| 117 } |
| 118 |
| 95 void main() { | 119 void main() { |
| 96 testServerCompress(); | 120 testServerCompress(); |
| 97 testServerCompress(clientAutoUncompress: false); | 121 testServerCompress(clientAutoUncompress: false); |
| 98 testAcceptEncodingHeader(); | 122 testAcceptEncodingHeader(); |
| 123 testDisableCompressTest(); |
| 99 } | 124 } |
| OLD | NEW |