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

Unified Diff: pkg/http/lib/src/request.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/multipart_file.dart ('k') | pkg/http/lib/src/response.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/request.dart
diff --git a/pkg/http/lib/src/request.dart b/pkg/http/lib/src/request.dart
index 9f024e6e95fb78fcf3efeb912b36d70551f5b03c..8aacbe387877d372c04d3625b90f3ff37c1d21fc 100644
--- a/pkg/http/lib/src/request.dart
+++ b/pkg/http/lib/src/request.dart
@@ -4,6 +4,7 @@
library request;
+import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
@@ -36,7 +37,7 @@ class Request extends BaseRequest {
/// If the request has a `Content-Type` header and that header has a `charset`
/// parameter, that parameter's value is used as the encoding. Otherwise, if
/// [encoding] has been set manually, that encoding is used. If that hasn't
- /// been set either, this defaults to [Encoding.UTF_8].
+ /// been set either, this defaults to [UTF8].
///
/// If the `charset` parameter's value is not a known [Encoding], reading this
/// will throw a [FormatException].
@@ -83,10 +84,10 @@ class Request extends BaseRequest {
/// header, one will be added with the type `text/plain`. Then the `charset`
/// parameter of the `Content-Type` header (whether new or pre-existing) will
/// be set to [encoding] if it wasn't already set.
- String get body => decodeString(bodyBytes, encoding);
+ String get body => encoding.decode(bodyBytes);
set body(String value) {
- bodyBytes = encodeString(value, encoding);
+ bodyBytes = encoding.encode(value);
var contentType = _contentType;
if (contentType == null) {
contentType = new ContentType("text", "plain", charset: encoding.name);
@@ -137,7 +138,7 @@ class Request extends BaseRequest {
/// Creates a new HTTP request.
Request(String method, Uri url)
: super(method, url),
- _defaultEncoding = Encoding.UTF_8,
+ _defaultEncoding = UTF8,
_bodyBytes = new Uint8List(0);
/// Freezes all mutable fields and returns a single-subscription [ByteStream]
« no previous file with comments | « pkg/http/lib/src/multipart_file.dart ('k') | pkg/http/lib/src/response.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698