| Index: tests/standalone/src/io/HttpTest.dart
|
| diff --git a/tests/standalone/src/io/HttpTest.dart b/tests/standalone/src/io/HttpTest.dart
|
| index 62e18e27a5598fa3fa356c745283bcc9e4381c38..545b1a0925ad91df2a5a00f9de48f57aceabe332 100644
|
| --- a/tests/standalone/src/io/HttpTest.dart
|
| +++ b/tests/standalone/src/io/HttpTest.dart
|
| @@ -112,7 +112,7 @@ class TestServer extends Isolate {
|
| // Return a 404.
|
| void _notFoundHandler(HttpRequest request, HttpResponse response) {
|
| response.statusCode = HttpStatus.NOT_FOUND;
|
| - response.setHeader("Content-Type", "text/html; charset=UTF-8");
|
| + response.headers.set("Content-Type", "text/html; charset=UTF-8");
|
| response.outputStream.writeString("Page not found");
|
| response.outputStream.close();
|
| }
|
| @@ -126,7 +126,10 @@ class TestServer extends Isolate {
|
|
|
| // Check the "Host" header.
|
| void _hostHandler(HttpRequest request, HttpResponse response) {
|
| - Expect.equals("www.dartlang.org:1234", request.headers["host"]);
|
| + Expect.equals(1, request.headers["Host"].length);
|
| + Expect.equals("www.dartlang.org:1234", request.headers["Host"][0]);
|
| + Expect.equals("www.dartlang.org", request.headers.host);
|
| + Expect.equals(1234, request.headers.port);
|
| response.statusCode = HttpStatus.OK;
|
| response.outputStream.close();
|
| }
|
| @@ -136,18 +139,18 @@ class TestServer extends Isolate {
|
| Date date =
|
| new Date.withTimeZone(
|
| 1999, Date.JUN, 11, 18, 46, 53, 0, new TimeZone.utc());
|
| - response.expires = date;
|
| - Expect.equals(date, response.expires);
|
| + response.headers.expires = date;
|
| + Expect.equals(date, response.headers.expires);
|
| response.outputStream.close();
|
| }
|
|
|
| // Set the "Expires" header.
|
| void _expires2Handler(HttpRequest request, HttpResponse response) {
|
| - response.setHeader("Expires", "Fri, 11 Jun 1999 18:46:53 GMT");
|
| + response.headers.set("Expires", "Fri, 11 Jun 1999 18:46:53 GMT");
|
| Date date =
|
| new Date.withTimeZone(
|
| 1999, Date.JUN, 11, 18, 46, 53, 0, new TimeZone.utc());
|
| - Expect.equals(date, response.expires);
|
| + Expect.equals(date, response.headers.expires);
|
| response.outputStream.close();
|
| }
|
|
|
| @@ -446,22 +449,26 @@ void testHost() {
|
| HttpClientConnection conn =
|
| httpClient.get("127.0.0.1", port, "/host");
|
| conn.onRequest = (HttpClientRequest request) {
|
| - Expect.equals("127.0.0.1:$port", request.headers["host"]);
|
| - request.host = "www.dartlang.com";
|
| - Expect.equals("www.dartlang.com:$port", request.headers["host"]);
|
| - request.port = 1234;
|
| - Expect.equals("www.dartlang.com:1234", request.headers["host"]);
|
| - request.port = HttpClient.DEFAULT_HTTP_PORT;
|
| - Expect.equals("www.dartlang.com", request.headers["host"]);
|
| - request.setHeader("Host", "www.dartlang.org");
|
| - Expect.equals("www.dartlang.org", request.host);
|
| - Expect.equals(HttpClient.DEFAULT_HTTP_PORT, request.port);
|
| - request.setHeader("Host", "www.dartlang.org:");
|
| - Expect.equals("www.dartlang.org", request.host);
|
| - Expect.equals(HttpClient.DEFAULT_HTTP_PORT, request.port);
|
| - request.setHeader("Host", "www.dartlang.org:1234");
|
| - Expect.equals("www.dartlang.org", request.host);
|
| - Expect.equals(1234, request.port);
|
| + Expect.equals("127.0.0.1:$port", request.headers["host"][0]);
|
| + request.headers.host = "www.dartlang.com";
|
| + Expect.equals("www.dartlang.com:$port", request.headers["host"][0]);
|
| + Expect.equals("www.dartlang.com", request.headers.host);
|
| + Expect.equals(port, request.headers.port);
|
| + request.headers.port = 1234;
|
| + Expect.equals("www.dartlang.com:1234", request.headers["host"][0]);
|
| + Expect.equals(1234, request.headers.port);
|
| + request.headers.port = HttpClient.DEFAULT_HTTP_PORT;
|
| + Expect.equals(HttpClient.DEFAULT_HTTP_PORT, request.headers.port);
|
| + Expect.equals("www.dartlang.com", request.headers["host"][0]);
|
| + request.headers.set("Host", "www.dartlang.org");
|
| + Expect.equals("www.dartlang.org", request.headers.host);
|
| + Expect.equals(HttpClient.DEFAULT_HTTP_PORT, request.headers.port);
|
| + request.headers.set("Host", "www.dartlang.org:");
|
| + Expect.equals("www.dartlang.org", request.headers.host);
|
| + Expect.equals(HttpClient.DEFAULT_HTTP_PORT, request.headers.port);
|
| + request.headers.set("Host", "www.dartlang.org:1234");
|
| + Expect.equals("www.dartlang.org", request.headers.host);
|
| + Expect.equals(1234, request.headers.port);
|
| request.outputStream.close();
|
| };
|
| conn.onResponse = (HttpClientResponse response) {
|
| @@ -482,11 +489,11 @@ void testExpires() {
|
| void processResponse(HttpClientResponse response) {
|
| Expect.equals(HttpStatus.OK, response.statusCode);
|
| Expect.equals("Fri, 11 Jun 1999 18:46:53 GMT",
|
| - response.headers["expires"]);
|
| + response.headers["expires"][0]);
|
| Expect.equals(
|
| new Date.withTimeZone(
|
| 1999, Date.JUN, 11, 18, 46, 53, 0, new TimeZone.utc()),
|
| - response.expires);
|
| + response.headers.expires);
|
| responses++;
|
| if (responses == 2) {
|
| httpClient.shutdown();
|
| @@ -508,7 +515,7 @@ void testExpires() {
|
|
|
|
|
| void main() {
|
| - testStartStop();
|
| + //testStartStop();
|
| testGET();
|
| testPOST(true);
|
| testPOST(false);
|
|
|