| 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 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 response.close(); | 138 response.close(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void _contentType1Handler(HttpRequest request) { | 141 void _contentType1Handler(HttpRequest request) { |
| 142 var response = request.response; | 142 var response = request.response; |
| 143 Expect.equals("text/html", request.headers.contentType.value); | 143 Expect.equals("text/html", request.headers.contentType.value); |
| 144 Expect.equals("text", request.headers.contentType.primaryType); | 144 Expect.equals("text", request.headers.contentType.primaryType); |
| 145 Expect.equals("html", request.headers.contentType.subType); | 145 Expect.equals("html", request.headers.contentType.subType); |
| 146 Expect.equals("utf-8", request.headers.contentType.parameters["charset"]); | 146 Expect.equals("utf-8", request.headers.contentType.parameters["charset"]); |
| 147 | 147 |
| 148 ContentType contentType = new ContentType("text", "html"); | 148 ContentType contentType = new ContentType("text", "html", charset: "utf-8"); |
| 149 contentType.parameters["charset"] = "utf-8"; | |
| 150 response.headers.contentType = contentType; | 149 response.headers.contentType = contentType; |
| 151 response.close(); | 150 response.close(); |
| 152 } | 151 } |
| 153 | 152 |
| 154 void _contentType2Handler(HttpRequest request) { | 153 void _contentType2Handler(HttpRequest request) { |
| 155 var response = request.response; | 154 var response = request.response; |
| 156 Expect.equals("text/html", request.headers.contentType.value); | 155 Expect.equals("text/html", request.headers.contentType.value); |
| 157 Expect.equals("text", request.headers.contentType.primaryType); | 156 Expect.equals("text", request.headers.contentType.primaryType); |
| 158 Expect.equals("html", request.headers.contentType.subType); | 157 Expect.equals("html", request.headers.contentType.subType); |
| 159 Expect.equals("utf-8", request.headers.contentType.parameters["charset"]); | 158 Expect.equals("utf-8", request.headers.contentType.parameters["charset"]); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 if (responses == 2) { | 339 if (responses == 2) { |
| 341 httpClient.close(); | 340 httpClient.close(); |
| 342 server.shutdown(); | 341 server.shutdown(); |
| 343 completer.complete(true); | 342 completer.complete(true); |
| 344 } | 343 } |
| 345 }); | 344 }); |
| 346 } | 345 } |
| 347 | 346 |
| 348 httpClient.get("127.0.0.1", port, "/contenttype1") | 347 httpClient.get("127.0.0.1", port, "/contenttype1") |
| 349 .then((request) { | 348 .then((request) { |
| 350 ContentType contentType = new ContentType(); | 349 request.headers.contentType = |
| 351 contentType.value = "text/html"; | 350 new ContentType("text", "html", charset: "utf-8"); |
| 352 contentType.parameters["charset"] = "utf-8"; | |
| 353 request.headers.contentType = contentType; | |
| 354 return request.close(); | 351 return request.close(); |
| 355 }) | 352 }) |
| 356 .then(processResponse); | 353 .then(processResponse); |
| 357 | 354 |
| 358 httpClient.get("127.0.0.1", port, "/contenttype2") | 355 httpClient.get("127.0.0.1", port, "/contenttype2") |
| 359 .then((request) { | 356 .then((request) { |
| 360 request.headers.set(HttpHeaders.CONTENT_TYPE, | 357 request.headers.set(HttpHeaders.CONTENT_TYPE, |
| 361 "text/html; charset = utf-8"); | 358 "text/html; charset = utf-8"); |
| 362 return request.close(); | 359 return request.close(); |
| 363 }) | 360 }) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 420 |
| 424 void main() { | 421 void main() { |
| 425 testHost().then((_) { | 422 testHost().then((_) { |
| 426 return testExpires().then((_) { | 423 return testExpires().then((_) { |
| 427 return testContentType().then((_) { | 424 return testContentType().then((_) { |
| 428 return testCookies(); | 425 return testCookies(); |
| 429 }); | 426 }); |
| 430 }); | 427 }); |
| 431 }); | 428 }); |
| 432 } | 429 } |
| OLD | NEW |