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

Side by Side Diff: sdk/lib/io/http_body_impl.dart

Issue 18576006: Remove _HttpUtils from dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated comments and add encoding tests. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/uri.dart ('k') | sdk/lib/io/http_date.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 class _HttpBodyHandlerTransformer 7 class _HttpBodyHandlerTransformer
8 extends StreamEventTransformer<HttpRequest, HttpRequestBody> { 8 extends StreamEventTransformer<HttpRequest, HttpRequestBody> {
9 final Encoding _defaultEncoding; 9 final Encoding _defaultEncoding;
10 _HttpBodyHandlerTransformer(this._defaultEncoding); 10 _HttpBodyHandlerTransformer(this._defaultEncoding);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 switch (contentType.subType) { 113 switch (contentType.subType) {
114 case "json": 114 case "json":
115 return asText(Encoding.UTF_8) 115 return asText(Encoding.UTF_8)
116 .then((body) => new _HttpBody(contentType, 116 .then((body) => new _HttpBody(contentType,
117 "json", 117 "json",
118 JSON.parse(body.body))); 118 JSON.parse(body.body)));
119 119
120 case "x-www-form-urlencoded": 120 case "x-www-form-urlencoded":
121 return asText(Encoding.ASCII) 121 return asText(Encoding.ASCII)
122 .then((body) { 122 .then((body) {
123 var map = _HttpUtils.splitQueryString( 123 var map = Uri.splitQueryString(body.body,
124 body.body, encoding: defaultEncoding); 124 decode: (s) => _decodeString(s, defaultEncoding));
125 var result = {}; 125 var result = {};
126 for (var key in map.keys) { 126 for (var key in map.keys) {
127 result[key] = map[key]; 127 result[key] = map[key];
128 } 128 }
129 return new _HttpBody(contentType, "form", result); 129 return new _HttpBody(contentType, "form", result);
130 }); 130 });
131 131
132 default: 132 default:
133 break; 133 break;
134 } 134 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 _HttpClientResponseBody(HttpClientResponse response, HttpBody body) 190 _HttpClientResponseBody(HttpClientResponse response, HttpBody body)
191 : super(body.contentType, body.type, body.body), 191 : super(body.contentType, body.type, body.body),
192 this.response = response; 192 this.response = response;
193 193
194 int get statusCode => response.statusCode; 194 int get statusCode => response.statusCode;
195 195
196 String get reasonPhrase => response.reasonPhrase; 196 String get reasonPhrase => response.reasonPhrase;
197 197
198 HttpHeaders get headers => response.headers; 198 HttpHeaders get headers => response.headers;
199 } 199 }
OLDNEW
« no previous file with comments | « sdk/lib/core/uri.dart ('k') | sdk/lib/io/http_date.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698