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

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

Issue 12595004: Fix handling to responses to HEAD requests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 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_parser.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_head_test.dart
diff --git a/tests/standalone/io/http_head_test.dart b/tests/standalone/io/http_head_test.dart
index 9325ceb553814ad0c80f8e5bb97ad8585281cbf5..60e7321cda3c3afe20c36f5c71e2dd63c460a598 100644
--- a/tests/standalone/io/http_head_test.dart
+++ b/tests/standalone/io/http_head_test.dart
@@ -16,6 +16,14 @@ void testHEAD(int totalConnections) {
List<int> data = new List<int>.filled(200, 0);
response.add(data);
response.close();
+ } else if (request.uri.path == "/testChunked100") {
+ List<int> data = new List<int>.filled(100, 0);
+ response.add(data);
+ response.close();
+ } else if (request.uri.path == "/testChunked200") {
+ List<int> data = new List<int>.filled(200, 0);
+ response.add(data);
+ response.close();
} else {
assert(false);
}
@@ -24,6 +32,15 @@ void testHEAD(int totalConnections) {
HttpClient client = new HttpClient();
int count = 0;
+
+ requestDone() {
+ count++;
+ if (count == totalConnections * 2) {
+ client.close();
+ server.close();
+ }
+ }
+
for (int i = 0; i < totalConnections; i++) {
int len = (i % 2 == 0) ? 100 : 200;
client.open("HEAD", "127.0.0.1", server.port, "/test$len")
@@ -32,13 +49,17 @@ void testHEAD(int totalConnections) {
Expect.equals(len, response.contentLength);
response.listen(
(_) => Expect.fail("Data from HEAD request"),
- onDone: () {
- count++;
- if (count == totalConnections) {
- client.close();
- server.close();
- }
- });
+ onDone: requestDone);
+ });
+
+ client.open("HEAD", "127.0.0.1", server.port, "/testChunked$len")
+ .then((request) => request.close())
+ .then((HttpClientResponse response) {
+ print(response.headers);
+ Expect.equals(-1, response.contentLength);
+ response.listen(
+ (_) => Expect.fail("Data from HEAD request"),
+ onDone: requestDone);
});
}
});
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698