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

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

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 7 years, 4 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/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/response.dart
diff --git a/pkg/http/lib/src/response.dart b/pkg/http/lib/src/response.dart
index b7e0a481da810db6a4884f9e974a727fb5b0a41e..435027d7e83ffb19c6f45213785ccb7e096890ba 100644
--- a/pkg/http/lib/src/response.dart
+++ b/pkg/http/lib/src/response.dart
@@ -5,6 +5,7 @@
library response;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
@@ -21,10 +22,10 @@ class Response extends BaseResponse {
/// The body of the response as a string. This is converted from [bodyBytes]
/// using the `charset` parameter of the `Content-Type` header field, if
/// available. If it's unavailable or if the encoding name is unknown,
- /// [Encoding.ISO_8859_1] is used by default, as per [RFC 2616][].
+ /// [LATIN1] is used by default, as per [RFC 2616][].
///
/// [RFC 2616]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html
- String get body => decodeString(bodyBytes, _encodingForHeaders(headers));
+ String get body => _encodingForHeaders(headers).decode(bodyBytes);
/// Creates a new HTTP response with a string body.
Response(
@@ -36,7 +37,7 @@ class Response extends BaseResponse {
bool persistentConnection: true,
String reasonPhrase})
: this.bytes(
- encodeString(body, _encodingForHeaders(headers)),
+ _encodingForHeaders(headers).encode(body),
statusCode,
request: request,
headers: headers,
@@ -80,7 +81,7 @@ class Response extends BaseResponse {
}
/// Returns the encoding to use for a response with the given headers. This
-/// defaults to [Encoding.ISO_8859_1] if the headers don't specify a charset or
+/// defaults to [LATIN1] if the headers don't specify a charset or
/// if that charset is unknown.
Encoding _encodingForHeaders(Map<String, String> headers) =>
encodingForCharset(_contentTypeForHeaders(headers).charset);
« no previous file with comments | « pkg/http/lib/src/request.dart ('k') | pkg/http/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698