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/streamed_response.dart

Issue 11825010: Update pkg/http to use the new async APIs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 11 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 | « pkg/http/lib/src/streamed_request.dart ('k') | pkg/http/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/streamed_response.dart
diff --git a/pkg/http/lib/src/streamed_response.dart b/pkg/http/lib/src/streamed_response.dart
index 218643b2127469915d5ba68ff643c8efdfc5be9b..17752de9ff751381e537aec8e9e74b2f996c2990 100644
--- a/pkg/http/lib/src/streamed_response.dart
+++ b/pkg/http/lib/src/streamed_response.dart
@@ -4,20 +4,25 @@
library streamed_response;
+import 'dart:async';
import 'dart:io';
+import 'byte_stream.dart';
import 'base_response.dart';
import 'base_request.dart';
+import 'utils.dart';
/// An HTTP response where the response body is received asynchronously after
/// the headers have been received.
class StreamedResponse extends BaseResponse {
- /// The stream from which the response body data can be read.
- final InputStream stream;
+ /// The stream from which the response body data can be read. This should
+ /// always be a single-subscription stream.
+ final ByteStream stream;
- /// Creates a new streaming response.
+ /// Creates a new streaming response. [stream] should be a single-subscription
+ /// stream.
StreamedResponse(
- this.stream,
+ Stream<List<int>> stream,
int statusCode,
int contentLength,
{BaseRequest request,
@@ -32,5 +37,6 @@ class StreamedResponse extends BaseResponse {
headers: headers,
isRedirect: isRedirect,
persistentConnection: persistentConnection,
- reasonPhrase: reasonPhrase);
+ reasonPhrase: reasonPhrase),
+ this.stream = toByteStream(stream);
}
« no previous file with comments | « pkg/http/lib/src/streamed_request.dart ('k') | pkg/http/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698