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

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

Issue 14113006: Fix HttpBodyHandler to handle missing mimeType. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix comment. Created 7 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 | « 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_body_test.dart
diff --git a/tests/standalone/io/http_body_test.dart b/tests/standalone/io/http_body_test.dart
index c25406e0f643111ee6a681341000b179e94fbf88..ae0d128242965fb8f3ce586a499f35d9b680b3d0 100644
--- a/tests/standalone/io/http_body_test.dart
+++ b/tests/standalone/io/http_body_test.dart
@@ -98,13 +98,20 @@ void testHttpServerRequestBody() {
Expect.equals(type, body.type);
switch (type) {
case "text":
+ Expect.equals(body.mimeType, "text/plain");
Expect.equals(expectedBody, body.body);
break;
case "json":
+ Expect.equals(body.mimeType, "application/json");
Expect.mapEquals(expectedBody, body.body);
break;
+ case "binary":
+ Expect.equals(body.mimeType, null);
+ Expect.listEquals(expectedBody, body.body);
+ break;
+
default:
Expect.fail("bad body type");
}
@@ -116,8 +123,10 @@ void testHttpServerRequestBody() {
var client = new HttpClient();
client.post("127.0.0.1", server.port, "/")
.then((request) {
- request.headers.contentType =
- new ContentType.fromString(mimeType);
+ if (mimeType != null) {
+ request.headers.contentType =
+ new ContentType.fromString(mimeType);
+ }
request.add(content);
return request.close();
})
@@ -152,6 +161,8 @@ void testHttpServerRequestBody() {
null,
"json",
true);
+
+ test(null, "body".codeUnits, "body".codeUnits, "binary");
}
« 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