| Index: pkg/shelf/test/request_test.dart
|
| diff --git a/pkg/shelf/test/request_test.dart b/pkg/shelf/test/request_test.dart
|
| index 72a87a6b32675f02ea1ae0b32923792a95691bf1..c48a4f73a767810f92fa5924cb46080d990d7a10 100644
|
| --- a/pkg/shelf/test/request_test.dart
|
| +++ b/pkg/shelf/test/request_test.dart
|
| @@ -136,44 +136,35 @@ void main() {
|
| });
|
| });
|
|
|
| - group("readAsString", () {
|
| - test("supports a null body", () {
|
| - var request = _request();
|
| - expect(request.readAsString(), completion(equals("")));
|
| - });
|
| -
|
| - test("supports a Stream<List<int>> body", () {
|
| + group('change', () {
|
| + test('with no arguments returns instance with equal values', () {
|
| var controller = new StreamController();
|
| - var request = _request({}, controller.stream);
|
| - expect(request.readAsString(), completion(equals("hello, world")));
|
|
|
| - controller.add([104, 101, 108, 108, 111, 44]);
|
| - return new Future(() {
|
| - controller
|
| - ..add([32, 119, 111, 114, 108, 100])
|
| - ..close();
|
| - });
|
| - });
|
| - });
|
| + var uri = Uri.parse('https://test.example.com/static/file.html');
|
|
|
| - group("read", () {
|
| - test("supports a null body", () {
|
| - var request = _request();
|
| - expect(request.read().toList(), completion(isEmpty));
|
| - });
|
| + var request = new Request('GET', uri,
|
| + protocolVersion: '2.0',
|
| + headers: {'header1': 'header value 1'},
|
| + url: Uri.parse('/file.html'),
|
| + scriptName: '/static',
|
| + body: controller.stream,
|
| + context: {'context1': 'context value 1'});
|
|
|
| - test("supports a Stream<List<int>> body", () {
|
| - var controller = new StreamController();
|
| - var request = _request({}, controller.stream);
|
| - expect(request.read().toList(), completion(equals([
|
| - [104, 101, 108, 108, 111, 44],
|
| - [32, 119, 111, 114, 108, 100]
|
| - ])));
|
| + var copy = request.change();
|
| +
|
| + expect(copy.method, request.method);
|
| + expect(copy.requestedUri, request.requestedUri);
|
| + expect(copy.protocolVersion, request.protocolVersion);
|
| + expect(copy.headers, same(request.headers));
|
| + expect(copy.url, request.url);
|
| + expect(copy.scriptName, request.scriptName);
|
| + expect(copy.context, same(request.context));
|
| + expect(copy.readAsString(), completion('hello, world'));
|
|
|
| - controller.add([104, 101, 108, 108, 111, 44]);
|
| + controller.add(HELLO_BYTES);
|
| return new Future(() {
|
| controller
|
| - ..add([32, 119, 111, 114, 108, 100])
|
| + ..add(WORLD_BYTES)
|
| ..close();
|
| });
|
| });
|
|
|