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

Unified Diff: pkg/http/lib/src/utils.dart

Issue 12191008: Get the pub oauth2 test passing locally. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
Index: pkg/http/lib/src/utils.dart
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index c61733ef0c6f1b342ffa7eca0410443c1a8d056e..a70e9370058b744f7efc11c221b19d7cd6f7e161 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -309,3 +309,16 @@ Future forEachFuture(Iterable input, Future fn(element)) {
}
return nextElement(null);
}
+
+// TODO(nweiz): remove this when issue 8310 is fixed.
+/// Returns a [Stream] identical to [stream], but piped through a new
+/// [StreamController]. This exists to work around issue 8310.
+Stream wrapStream(Stream stream) {
+ var controller = stream.isBroadcast
+ ? new StreamController.broadcast()
+ : new StreamController();
+ stream.listen(controller.add,
+ onError: (e) => controller.signalError(e),
+ onDone: controller.close);
+ return controller.stream;
+}

Powered by Google App Engine
This is Rietveld 408576698