Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Unified Diff: samples/chat/chat_server_lib.dart

Issue 12504006: Make IOSink implement StringSink (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed second round of review comments Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | samples/tests/samples/chat/chat_server_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/chat/chat_server_lib.dart
diff --git a/samples/chat/chat_server_lib.dart b/samples/chat/chat_server_lib.dart
index 5741417947238fc934bc7cd3dc32acc44930373a..b77bd69fc4245a3f9498de042cdfee534297951e 100644
--- a/samples/chat/chat_server_lib.dart
+++ b/samples/chat/chat_server_lib.dart
@@ -303,7 +303,7 @@ class IsolatedServer {
void _sendJSONResponse(HttpResponse response, Map responseData) {
response.headers.set("Content-Type", "application/json; charset=UTF-8");
- response.addString(json.stringify(responseData));
+ response.write(json.stringify(responseData));
response.close();
}
@@ -317,7 +317,8 @@ class IsolatedServer {
response.headers.set(
"Location", "http://$_host:$_port/${redirectPath}");
response.contentLength = _redirectPage.length;
- response.add(_redirectPage);
+ print(_redirectPage.length);
+ response.writeBytes(_redirectPage);
response.close();
}
@@ -360,7 +361,7 @@ class IsolatedServer {
response.statusCode = HttpStatus.NOT_FOUND;
response.headers.set("Content-Type", "text/html; charset=UTF-8");
response.contentLength = _notFoundPage.length;
- response.add(_notFoundPage);
+ response.writeBytes(_notFoundPage);
response.close();
}
@@ -377,7 +378,7 @@ class IsolatedServer {
void _joinHandler(HttpRequest request, HttpResponse response) {
StringBuffer body = new StringBuffer();
request.listen(
- (data) => body.add(new String.fromCharCodes(data)),
+ (data) => body.write(new String.fromCharCodes(data)),
onDone: () {
String data = body.toString();
if (data != null) {
@@ -411,7 +412,7 @@ class IsolatedServer {
void _leaveHandler(HttpRequest request, HttpResponse response) {
StringBuffer body = new StringBuffer();
request.listen(
- (data) => body.add(new String.fromCharCodes(data)),
+ (data) => body.write(new String.fromCharCodes(data)),
onDone: () {
String data = body.toString();
var requestData = json.parse(data);
@@ -441,7 +442,7 @@ class IsolatedServer {
void _messageHandler(HttpRequest request, HttpResponse response) {
StringBuffer body = new StringBuffer();
request.listen(
- (data) => body.add(new String.fromCharCodes(data)),
+ (data) => body.write(new String.fromCharCodes(data)),
onDone: () {
String data = body.toString();
_messageCount++;
@@ -478,7 +479,7 @@ class IsolatedServer {
void _receiveHandler(HttpRequest request, HttpResponse response) {
StringBuffer body = new StringBuffer();
request.listen(
- (data) => body.add(new String.fromCharCodes(data)),
+ (data) => body.write(new String.fromCharCodes(data)),
onDone: () {
String data = body.toString();
var requestData = json.parse(data);
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | samples/tests/samples/chat/chat_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698