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

Unified Diff: samples/chat/chat_server_lib.dart

Issue 10082003: Start refactoring of the HTTP header handling (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed second round of comments Created 8 years, 8 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/io.dart ('k') | tests/standalone/src/io/HttpTest.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 fe28ef4ebfa51ccd59bcb90715fdc97264eae86b..f88a68850323a7a7891ca3b33d34e4331cc65627 100644
--- a/samples/chat/chat_server_lib.dart
+++ b/samples/chat/chat_server_lib.dart
@@ -330,7 +330,7 @@ class IsolatedServer extends Isolate {
</body></html>""";
void _sendJSONResponse(HttpResponse response, Map responseData) {
- response.setHeader("Content-Type", "application/json; charset=UTF-8");
+ response.headers.set("Content-Type", "application/json; charset=UTF-8");
response.outputStream.writeString(JSON.stringify(responseData));
response.outputStream.close();
}
@@ -346,7 +346,7 @@ class IsolatedServer extends Isolate {
_redirectPage = redirectPageHtml.charCodes();
}
response.statusCode = HttpStatus.FOUND;
- response.setHeader(
+ response.headers.set(
"Location", "http://$_host:$_port/${redirectPath}");
response.contentLength = _redirectPage.length;
response.outputStream.write(_redirectPage);
@@ -371,7 +371,7 @@ class IsolatedServer extends Isolate {
if (extension == ".ico") { mimeType = "image/vnd.microsoft.icon"; }
if (extension == ".png") { mimeType = "image/png"; }
}
- response.setHeader("Content-Type", mimeType);
+ response.headers.set("Content-Type", mimeType);
// Get the length of the file for setting the Content-Length header.
RandomAccessFile openedFile = file.openSync();
response.contentLength = openedFile.lengthSync();
@@ -390,7 +390,7 @@ class IsolatedServer extends Isolate {
_notFoundPage = notFoundPageHtml.charCodes();
}
response.statusCode = HttpStatus.NOT_FOUND;
- response.setHeader("Content-Type", "text/html; charset=UTF-8");
+ response.headers.set("Content-Type", "text/html; charset=UTF-8");
response.contentLength = _notFoundPage.length;
response.outputStream.write(_notFoundPage);
response.outputStream.close();
« no previous file with comments | « runtime/bin/io.dart ('k') | tests/standalone/src/io/HttpTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698