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

Unified Diff: runtime/bin/builtin.dart

Issue 18438005: Move MimeMultipartTransformer and HttpBodyHandler to mime and http_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove import. Created 7 years, 5 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/mime/test/mime_multipart_transformer_test.dart ('k') | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.dart
diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart
index 818acaf7c7ab5ee7b7e3cce51573baac6c2008c5..700eed70960f384972893ed7f3f6635c7b1176b8 100644
--- a/runtime/bin/builtin.dart
+++ b/runtime/bin/builtin.dart
@@ -35,14 +35,16 @@ _getHttpRequestResponseCode() => _httpRequestResponseCode;
_getHttpRequestStatusString() => _httpRequestStatusString;
_getHttpRequestResponse() => _httpRequestResponse;
-void _requestCompleted(HttpClientResponseBody body) {
- _httpRequestResponseCode = body.statusCode;
- _httpRequestStatusString = '${body.statusCode} ${body.reasonPhrase}';
+void _requestCompleted(List<int> data, HttpClientResponse response) {
+ _httpRequestResponseCode = response.statusCode;
+ _httpRequestStatusString = '${response.statusCode} ${response.reasonPhrase}';
_httpRequestResponse = null;
- if (body.statusCode != 200 || body.type == 'json') {
+ if (response.statusCode != 200 ||
+ (response.headers.contentType != null &&
+ response.headers.contentType.mimeType == 'application/json')) {
return;
}
- _httpRequestResponse = body.body;
+ _httpRequestResponse = data;
}
@@ -61,9 +63,12 @@ void _makeHttpRequest(String uri) {
Uri requestUri = Uri.parse(uri);
_client.getUrl(requestUri)
.then((HttpClientRequest request) => request.close())
- .then(HttpBodyHandler.processResponse)
- .then((HttpClientResponseBody body) {
- _requestCompleted(body);
+ .then((HttpClientResponse response) {
+ return response
+ .fold(new BytesBuilder(), (b, d) => b..add(d))
+ .then((builder) {
+ _requestCompleted(builder.takeBytes(), response);
+ });
}).catchError((error) {
_requestFailed(error);
});
« no previous file with comments | « pkg/mime/test/mime_multipart_transformer_test.dart ('k') | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698