Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Unified Diff: test/shelf_io_test.dart

Issue 1037483002: Add support for controlling HttpResponse.bufferOutput to shelf_io. (Closed) Base URL: git@github.com:dart-lang/shelf@master
Patch Set: Code review changes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/shelf_io_test.dart
diff --git a/test/shelf_io_test.dart b/test/shelf_io_test.dart
index 586a9615858b7b59c79d9876830404f759d8d85f..11c5b7cf140d656bfc1c4bcdea5941f50ea00034 100644
--- a/test/shelf_io_test.dart
+++ b/test/shelf_io_test.dart
@@ -10,6 +10,7 @@ import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:http_parser/http_parser.dart' as parser;
+import 'package:scheduled_test/scheduled_stream.dart';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;
@@ -331,6 +332,35 @@ void main() {
});
});
});
+
+ test('respects the "shelf.io.buffer_output" context parameter', () {
+ var controller = new StreamController();
+ _scheduleServer((request) {
+ controller.add("Hello, ");
+
+ return new Response.ok(UTF8.encoder.bind(controller.stream),
+ context: {"shelf.io.buffer_output": false});
+ });
+
+ schedule(() {
+ var request = new http.Request(
+ "GET", Uri.parse('http://localhost:$_serverPort/'));
+
+ return request.send().then((response) {
+ var stream = new ScheduledStream(UTF8.decoder.bind(response.stream));
+
+ return stream.next().then((data) {
+ expect(data, equals("Hello, "));
+ controller.add("world!");
+ return stream.next();
+ }).then((data) {
+ expect(data, equals("world!"));
+ controller.close();
+ expect(stream.hasNext, completion(isFalse));
+ });
+ });
+ });
+ });
}
int _serverPort;
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698