Index: sdk/lib/io/http_impl.dart |
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart |
index 2de2e0052c54bc017b3820631f2465af1186d3b0..19adf28b06bf2377ee4197f1250f8213690f9d5a 100644 |
--- a/sdk/lib/io/http_impl.dart |
+++ b/sdk/lib/io/http_impl.dart |
@@ -153,8 +153,9 @@ class _HttpHeaders implements HttpHeaders { |
} |
void _add(String name, Object value) { |
+ var lowerCaseName = name.toLowerCase(); |
// TODO(sgjesse): Add immutable state throw HttpException is immutable. |
- if (name.toLowerCase() == "date") { |
+ if (lowerCaseName == "date") { |
if (value is Date) { |
date = value; |
} else if (value is String) { |
@@ -162,7 +163,7 @@ class _HttpHeaders implements HttpHeaders { |
} else { |
throw new HttpException("Unexpected type for header named $name"); |
} |
- } else if (name.toLowerCase() == "expires") { |
+ } else if (lowerCaseName == "expires") { |
if (value is Date) { |
expires = value; |
} else if (value is String) { |
@@ -170,7 +171,7 @@ class _HttpHeaders implements HttpHeaders { |
} else { |
throw new HttpException("Unexpected type for header named $name"); |
} |
- } else if (name.toLowerCase() == "if-modified-since") { |
+ } else if (lowerCaseName == "if-modified-since") { |
if (value is Date) { |
ifModifiedSince = value; |
} else if (value is String) { |
@@ -178,7 +179,7 @@ class _HttpHeaders implements HttpHeaders { |
} else { |
throw new HttpException("Unexpected type for header named $name"); |
} |
- } else if (name.toLowerCase() == "host") { |
+ } else if (lowerCaseName == "host") { |
int pos = value.indexOf(":"); |
if (pos == -1) { |
_host = value; |
@@ -200,10 +201,10 @@ class _HttpHeaders implements HttpHeaders { |
} |
_set("host", value); |
} |
- } else if (name.toLowerCase() == "content-type") { |
+ } else if (lowerCaseName == "content-type") { |
_set("content-type", value); |
} else { |
- name = name.toLowerCase(); |
+ name = lowerCaseName; |
Søren Gjesse
2012/11/15 12:24:11
This line is not needed. Just use lowerCaseName tw
|
List<String> values = _headers[name]; |
if (values == null) { |
values = new List<String>(); |