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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/server.dart

Issue 134563004: Don't send all barback assets as text/html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/server.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/server.dart b/sdk/lib/_internal/pub/lib/src/barback/server.dart
index ab8f121d809d3f0cd49eda97d988c4bfe58bcfae..65e9f7d8d4c5c5063a0582f9b98d4ce0e6da9cb9 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/server.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/server.dart
@@ -88,10 +88,6 @@ class BarbackServer {
return;
}
- // Set content-type to force UTF-8 encoding.
- request.response.headers.contentType =
- ContentType.parse("text/html; charset=utf-8");
-
if (request.method != "GET" && request.method != "HEAD") {
_methodNotAllowed(request);
return;
@@ -264,6 +260,12 @@ class BarbackServer {
/// Responds to [request] with a 404 response and closes it.
void _notFound(HttpRequest request, message) {
_logRequest(request, "404 Not Found");
+
+ // Force a UTF-8 encoding so that error messages in non-English locales are
+ // sent correctly.
+ request.response.headers.contentType =
+ ContentType.parse("text/plain; charset=utf-8");
+
request.response.statusCode = 404;
request.response.reasonPhrase = "Not Found";
request.response.write(message);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698