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:isolate"; | 10 import "dart:isolate"; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 int count = 0; | 167 int count = 0; |
168 HttpClient httpClient = new HttpClient(); | 168 HttpClient httpClient = new HttpClient(); |
169 void sendRequest() { | 169 void sendRequest() { |
170 httpClient.post("127.0.0.1", port, "/echo") | 170 httpClient.post("127.0.0.1", port, "/echo") |
171 .then((request) { | 171 .then((request) { |
172 if (chunkedEncoding) { | 172 if (chunkedEncoding) { |
173 request.addString(data.substring(0, 10)); | 173 request.addString(data.substring(0, 10)); |
174 request.addString(data.substring(10, data.length)); | 174 request.addString(data.substring(10, data.length)); |
175 } else { | 175 } else { |
176 request.contentLength = data.length; | 176 request.contentLength = data.length; |
177 request.add(data.charCodes); | 177 request.add(data.codeUnits); |
178 } | 178 } |
179 return request.close(); | 179 return request.close(); |
180 }) | 180 }) |
181 .then((response) { | 181 .then((response) { |
182 Expect.equals(HttpStatus.OK, response.statusCode); | 182 Expect.equals(HttpStatus.OK, response.statusCode); |
183 List<int> body = new List<int>(); | 183 List<int> body = new List<int>(); |
184 response.listen( | 184 response.listen( |
185 body.addAll, | 185 body.addAll, |
186 onDone: () { | 186 onDone: () { |
187 Expect.equals(data, new String.fromCharCodes(body)); | 187 Expect.equals(data, new String.fromCharCodes(body)); |
(...skipping 14 matching lines...) Expand all Loading... |
202 if (chunkedEncoding) { | 202 if (chunkedEncoding) { |
203 server.chunkedEncoding(); | 203 server.chunkedEncoding(); |
204 } | 204 } |
205 server.start(); | 205 server.start(); |
206 } | 206 } |
207 | 207 |
208 void main() { | 208 void main() { |
209 testRead(true); | 209 testRead(true); |
210 testRead(false); | 210 testRead(false); |
211 } | 211 } |
OLD | NEW |