Chromium Code Reviews| Index: pkg/http/test/utils.dart |
| diff --git a/pkg/http/test/utils.dart b/pkg/http/test/utils.dart |
| index 8b404a581386cbaa2af8ba7c238a738b21af2d04..4767fb60621fe3370d9192213c69efbaabfef226 100644 |
| --- a/pkg/http/test/utils.dart |
| +++ b/pkg/http/test/utils.dart |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| @@ -58,15 +58,16 @@ Future startServer() { |
| new ByteStream(request).toBytes().then((requestBodyBytes) { |
| response.statusCode = 200; |
| - response.headers.contentType = new ContentType("application", "json"); |
| - response.headers.set('single', 'value'); |
| + var encodingName = request.queryParameters['response-encoding']; |
| + response.headers.contentType = |
| + new ContentType("application", "json", charset: encodingName); |
| + response.headers.set('single', 'value'); |
| var requestBody; |
| if (requestBodyBytes.isEmpty) { |
| requestBody = null; |
| } else if (request.headers.contentType.charset != null) { |
| - var encoding = requiredEncodingForCharset( |
|
nweiz
2013/03/06 20:31:51
If you've removed all references to requiredEncodi
Søren Gjesse
2013/03/07 16:28:47
Done.
|
| - request.headers.contentType.charset); |
| + var encoding = request.headers.contentType.encoding; |
| requestBody = decodeString(requestBodyBytes, encoding); |
| } else { |
| requestBody = requestBodyBytes; |
| @@ -86,17 +87,9 @@ Future startServer() { |
| content['headers'][name] = values; |
| }); |
| - var outputEncoding; |
| - var encodingName = request.queryParameters['response-encoding']; |
| - if (encodingName != null) { |
| - outputEncoding = requiredEncodingForCharset(encodingName); |
| - } else { |
| - outputEncoding = Encoding.ASCII; |
| - } |
| - |
| var body = json.stringify(content); |
| response.contentLength = body.length; |
| - response.addString(body, outputEncoding); |
| + response.write(body); |
| response.close(); |
| }); |
| }); |