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

Side by Side Diff: pkg/http_server/lib/src/http_body_impl.dart

Issue 24122002: Change Uri methods taking a decode argument, to now take an encoding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « pkg/http/lib/src/utils.dart ('k') | sdk/lib/core/uri.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 http_server; 5 part of http_server;
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 case "json": 114 case "json":
115 return asText(UTF8) 115 return asText(UTF8)
116 .then((body) => new _HttpBody(contentType, 116 .then((body) => new _HttpBody(contentType,
117 "json", 117 "json",
118 JSON.decode(body.body))); 118 JSON.decode(body.body)));
119 119
120 case "x-www-form-urlencoded": 120 case "x-www-form-urlencoded":
121 return asText(ASCII) 121 return asText(ASCII)
122 .then((body) { 122 .then((body) {
123 var map = Uri.splitQueryString(body.body, 123 var map = Uri.splitQueryString(body.body,
124 decode: (s) => defaultEncoding.decode(s)); 124 encoding: 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 | « pkg/http/lib/src/utils.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698