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 import "dart:async"; | 5 import "dart:async"; |
6 import "dart:io"; | 6 import "dart:io"; |
7 | 7 |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 socket.write('some body'); | 102 socket.write('some body'); |
103 socket.close(); | 103 socket.close(); |
104 }); | 104 }); |
105 }); | 105 }); |
106 }, onError: (e) { | 106 }, onError: (e) { |
107 asyncEnd(); | 107 asyncEnd(); |
108 }); | 108 }); |
109 } | 109 } |
110 | 110 |
111 | 111 |
| 112 void testAbsoluteUri() { |
| 113 asyncStart(); |
| 114 HttpServer.bind("127.0.0.1", 0).then((server) { |
| 115 server.listen((request) { |
| 116 Expect.equals("http://localhost:${server.port}/path?a=b#c", |
| 117 request.absoluteUri.toString()); |
| 118 request.response.close(); |
| 119 }); |
| 120 HttpClient client = new HttpClient(); |
| 121 client.get("localhost", server.port, "/path?a=b#c") |
| 122 .then((request) =>request.close()) |
| 123 .then((response) => response.drain()) |
| 124 .then((_) { |
| 125 server.close(); |
| 126 asyncEnd(); |
| 127 }); |
| 128 }); |
| 129 } |
| 130 |
| 131 |
112 void main() { | 132 void main() { |
113 testListenOn(); | 133 testListenOn(); |
114 testHttpServerZone(); | 134 testHttpServerZone(); |
115 testHttpServerZoneError(); | 135 testHttpServerZoneError(); |
| 136 testAbsoluteUri(); |
116 } | 137 } |
OLD | NEW |