| Index: pkg/http/test/utils.dart
|
| diff --git a/pkg/http/test/utils.dart b/pkg/http/test/utils.dart
|
| index 8b404a581386cbaa2af8ba7c238a738b21af2d04..a4767a28d4f89fb322b959308afa90b6ce2ad523 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(
|
| - request.headers.contentType.charset);
|
| + var encoding = Encoding.fromName(request.headers.contentType.charset);
|
| 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();
|
| });
|
| });
|
|
|