OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library shelf_io_test; | 5 library shelf_io_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return new Future.error('test'); | 68 return new Future.error('test'); |
69 }); | 69 }); |
70 | 70 |
71 return _scheduleGet().then((response) { | 71 return _scheduleGet().then((response) { |
72 expect(response.statusCode, HttpStatus.INTERNAL_SERVER_ERROR); | 72 expect(response.statusCode, HttpStatus.INTERNAL_SERVER_ERROR); |
73 expect(response.body, 'Internal Server Error'); | 73 expect(response.body, 'Internal Server Error'); |
74 }); | 74 }); |
75 }); | 75 }); |
76 | 76 |
77 test('Request is populated correctly', () { | 77 test('Request is populated correctly', () { |
78 var path = '/foo/bar?qs=value#anchor'; | 78 var path = '/foo/bar?qs=value'; |
79 | 79 |
80 _scheduleServer((request) { | 80 _scheduleServer((request) { |
81 expect(request.contentLength, 0); | 81 expect(request.contentLength, 0); |
82 expect(request.method, 'GET'); | 82 expect(request.method, 'GET'); |
83 | 83 |
84 var expectedUrl = 'http://localhost:$_serverPort$path'; | 84 var expectedUrl = 'http://localhost:$_serverPort$path'; |
85 expect(request.requestedUri, Uri.parse(expectedUrl)); | 85 expect(request.requestedUri, Uri.parse(expectedUrl)); |
86 | 86 |
87 expect(request.url.path, '/foo/bar'); | 87 expect(request.url.path, '/foo/bar'); |
88 expect(request.url.pathSegments, ['foo', 'bar']); | 88 expect(request.url.pathSegments, ['foo', 'bar']); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 var request = new http.Request('POST', | 246 var request = new http.Request('POST', |
247 Uri.parse('http://localhost:$_serverPort/')); | 247 Uri.parse('http://localhost:$_serverPort/')); |
248 | 248 |
249 if (headers != null) request.headers.addAll(headers); | 249 if (headers != null) request.headers.addAll(headers); |
250 if (body != null) request.body = body; | 250 if (body != null) request.body = body; |
251 | 251 |
252 return request.send(); | 252 return request.send(); |
253 }); | 253 }); |
254 } | 254 } |
OLD | NEW |