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

Unified Diff: tests/standalone/io/http_headers_test.dart

Issue 2225003002: Handle HTTP header parameters with empty values better (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments Created 4 years, 4 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 | « sdk/lib/io/http_headers.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_headers_test.dart
diff --git a/tests/standalone/io/http_headers_test.dart b/tests/standalone/io/http_headers_test.dart
index 1c84cd51fefe4eda662b03d3c78e0e0349c83484..26edb5fe1855770eeab7bd9ed6239d2170293e4d 100644
--- a/tests/standalone/io/http_headers_test.dart
+++ b/tests/standalone/io/http_headers_test.dart
@@ -380,6 +380,11 @@ void testContentType() {
" text/html ; charset = utf-8 ; xxx=yyy ");
check(contentType, "text", "html", {"charset": "utf-8", "xxx": "yyy"});
+ contentType = ContentType.parse("text/html; charset=;");
+ check(contentType, "text", "html", {"charset": null});
+ contentType = ContentType.parse("text/html; charset;");
+ check(contentType, "text", "html", {"charset": null});
+
// Test builtin content types.
check(ContentType.TEXT, "text", "plain", {"charset": "utf-8"});
check(ContentType.HTML, "text", "html", {"charset": "utf-8"});
@@ -387,6 +392,20 @@ void testContentType() {
check(ContentType.BINARY, "application", "octet-stream");
}
+void testKnownContentTypes() {
+ // Well known content types used by the VM service.
+ ContentType.parse('text/html; charset=UTF-8');
+ ContentType.parse('application/dart; charset=UTF-8');
+ ContentType.parse('application/javascript; charset=UTF-8');
+ ContentType.parse('text/css; charset=UTF-8');
+ ContentType.parse('image/gif');
+ ContentType.parse('image/png');
+ ContentType.parse('image/jpeg');
+ ContentType.parse('image/jpeg');
+ ContentType.parse('image/svg+xml');
+ ContentType.parse('text/plain');
+}
+
void testContentTypeCache() {
_HttpHeaders headers = new _HttpHeaders("1.1");
headers.set(HttpHeaders.CONTENT_TYPE, "text/html");
@@ -570,6 +589,7 @@ main() {
testEnumeration();
testHeaderValue();
testContentType();
+ testKnownContentTypes();
testContentTypeCache();
testCookie();
testInvalidCookie();
« no previous file with comments | « sdk/lib/io/http_headers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698