| OLD | NEW |
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = _HttpUtils.splitQueryString( |
| 124 body.body, encoding: defaultEncoding); | 124 body.body, encoding: defaultEncoding); |
| 125 var result = {}; | 125 var result = {}; |
| 126 String parse(String s) { | |
| 127 return _HttpUtils.decodeHttpEntityString(s); | |
| 128 } | |
| 129 for (var key in map.keys) { | 126 for (var key in map.keys) { |
| 130 result[parse(key)] = parse(map[key]); | 127 result[key] = map[key]; |
| 131 } | 128 } |
| 132 return new _HttpBody(contentType, "form", result); | 129 return new _HttpBody(contentType, "form", result); |
| 133 }); | 130 }); |
| 134 | 131 |
| 135 default: | 132 default: |
| 136 break; | 133 break; |
| 137 } | 134 } |
| 138 break; | 135 break; |
| 139 | 136 |
| 140 case "multipart": | 137 case "multipart": |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 _HttpClientResponseBody(HttpClientResponse response, HttpBody body) | 190 _HttpClientResponseBody(HttpClientResponse response, HttpBody body) |
| 194 : super(body.contentType, body.type, body.body), | 191 : super(body.contentType, body.type, body.body), |
| 195 this.response = response; | 192 this.response = response; |
| 196 | 193 |
| 197 int get statusCode => response.statusCode; | 194 int get statusCode => response.statusCode; |
| 198 | 195 |
| 199 String get reasonPhrase => response.reasonPhrase; | 196 String get reasonPhrase => response.reasonPhrase; |
| 200 | 197 |
| 201 HttpHeaders get headers => response.headers; | 198 HttpHeaders get headers => response.headers; |
| 202 } | 199 } |
| OLD | NEW |