Chromium Code Reviews| Index: sdk/lib/io/http_body.dart |
| diff --git a/sdk/lib/io/http_body.dart b/sdk/lib/io/http_body.dart |
| index 1ec6d175ed730474b4d5ad4d623331befa78ead3..b6e106bd1145281d03b304344496df986288ce0c 100644 |
| --- a/sdk/lib/io/http_body.dart |
| +++ b/sdk/lib/io/http_body.dart |
| @@ -41,22 +41,38 @@ class HttpBodyHandler |
| implements StreamTransformer<HttpRequest, HttpRequestBody> { |
| var _transformer; |
| - HttpBodyHandler() : _transformer = new _HttpBodyHandlerTransformer(); |
| + /** |
| + * Create a new [HttpBodyHandler] to be used with a [Stream]<[HttpRequest]>, |
| + * e.g. a [HttpServer]. |
| + * |
| + * If the page was served using different encoding than UTF-8, set |
| + * [defaultEncoding] accordingly. This is required for parsing |
| + * 'application/x-www-form-urlencoded' content correctly. |
|
Søren Gjesse
2013/05/16 07:13:58
At some point we should expand this comment and ex
Anders Johnsen
2013/05/16 07:40:16
Yeah. This would be a nice cleanup along with the
|
| + */ |
| + HttpBodyHandler({Encoding defaultEncoding: Encoding.UTF_8}) |
| + : _transformer = new _HttpBodyHandlerTransformer(defaultEncoding); |
| /** |
| * Process and parse an incoming [HttpRequest]. The returned [HttpRequestBody] |
| * contains a [response] field for accessing the [HttpResponse]. |
| + * |
| + * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. |
| */ |
| - static Future<HttpRequestBody> processRequest(HttpRequest request) { |
| - return _HttpBodyHandler.processRequest(request); |
| + static Future<HttpRequestBody> processRequest( |
| + HttpRequest request, |
| + {Encoding defaultEncoding: Encoding.UTF_8}) { |
| + return _HttpBodyHandler.processRequest(request, defaultEncoding); |
| } |
| /** |
| * Process and parse an incoming [HttpClientResponse]. |
| + * |
| + * See [HttpBodyHandler] constructor for more info on [defaultEncoding]. |
| */ |
| static Future<HttpClientResponseBody> processResponse( |
| - HttpClientResponse response) { |
| - return _HttpBodyHandler.processResponse(response); |
| + HttpClientResponse response, |
| + {Encoding defaultEncoding: Encoding.UTF_8}) { |
| + return _HttpBodyHandler.processResponse(response, defaultEncoding); |
| } |
| Stream<HttpRequestBody> bind(Stream<HttpRequest> stream) { |