| 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:io'; | 5 import 'dart:io'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 | 7 |
| 8 import 'package:http_server/http_server.dart'; | 8 import 'package:http_server/http_server.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 ContentType.parse(mimeType); | 149 ContentType.parse(mimeType); |
| 150 } | 150 } |
| 151 request.add(content); | 151 request.add(content); |
| 152 return request.close(); | 152 return request.close(); |
| 153 }) | 153 }) |
| 154 .then((response) { | 154 .then((response) { |
| 155 if (shouldFail) { | 155 if (shouldFail) { |
| 156 expect(response.statusCode, equals(HttpStatus.BAD_REQUEST)); | 156 expect(response.statusCode, equals(HttpStatus.BAD_REQUEST)); |
| 157 } | 157 } |
| 158 return response.drain(); | 158 return response.drain(); |
| 159 )} | 159 }) |
| 160 .then((_) { | 160 .then((_) { |
| 161 client.close(); | 161 client.close(); |
| 162 server.close(); | 162 server.close(); |
| 163 }); | 163 }); |
| 164 }); | 164 }); |
| 165 } | 165 } |
| 166 | 166 |
| 167 test("text/plain", "body".codeUnits, "body", "text"); | 167 test("text/plain", "body".codeUnits, "body", "text"); |
| 168 test("text/plain; charset=utf-8", | 168 test("text/plain; charset=utf-8", |
| 169 "body".codeUnits, | 169 "body".codeUnits, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 test('application/x-www-form-urlencoded', | 328 test('application/x-www-form-urlencoded', |
| 329 'name=%C8%A4%C8%A4'.codeUnits, | 329 'name=%C8%A4%C8%A4'.codeUnits, |
| 330 { 'name' : 'ȤȤ' }, | 330 { 'name' : 'ȤȤ' }, |
| 331 "form"); | 331 "form"); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void main() { | 334 void main() { |
| 335 testHttpClientResponseBody(); | 335 testHttpClientResponseBody(); |
| 336 testHttpServerRequestBody(); | 336 testHttpServerRequestBody(); |
| 337 } | 337 } |
| OLD | NEW |