Browse Source

use the combined encoder

Kevin Moore 10 years ago
parent
commit
6468733166
1 changed files with 3 additions and 1 deletions
  1. 3 1
      frameworks/Dart/dart/server.dart

+ 3 - 1
frameworks/Dart/dart/server.dart

@@ -9,6 +9,8 @@ import 'package:postgresql/postgresql.dart' as pg;
 import 'package:postgresql/postgresql_pool.dart' as pgpool;
 import 'package:postgresql/postgresql_pool.dart' as pgpool;
 import 'package:yaml/yaml.dart' as yaml;
 import 'package:yaml/yaml.dart' as yaml;
 
 
+final _encoder = new JsonUtf8Encoder();
+
 /// Starts a new HTTP server that implements the tests to be benchmarked.  The
 /// Starts a new HTTP server that implements the tests to be benchmarked.  The
 /// address and port for incoming connections is configurable via command line
 /// address and port for incoming connections is configurable via command line
 /// arguments, as is the number of database connections to be maintained in the
 /// arguments, as is the number of database connections to be maintained in the
@@ -154,7 +156,7 @@ void _sendHtml(HttpRequest request, String response) {
 /// Completes the given [request] by writing the [response] as JSON.
 /// Completes the given [request] by writing the [response] as JSON.
 void _sendJson(HttpRequest request, Object response) {
 void _sendJson(HttpRequest request, Object response) {
   _sendResponse(request, HttpStatus.OK,
   _sendResponse(request, HttpStatus.OK,
-      type: ContentType.JSON, response: UTF8.encode(JSON.encode(response)));
+      type: ContentType.JSON, response: _encoder.convert(response));
 }
 }
 
 
 /// Completes the given [request] by writing the [response] as plain text.
 /// Completes the given [request] by writing the [response] as plain text.