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

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

Issue 12377044: Add test for setting content-length through 'headers.set'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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: tests/standalone/io/http_content_length_test.dart
diff --git a/tests/standalone/io/http_content_length_test.dart b/tests/standalone/io/http_content_length_test.dart
index 61156827e3a4962b6fc1bbda55a31b49248851d2..92f9d6288d4a6474d562d3692bb284e185e27e35 100644
--- a/tests/standalone/io/http_content_length_test.dart
+++ b/tests/standalone/io/http_content_length_test.dart
@@ -231,6 +231,34 @@ void testHttp10() {
});
}
+void testSetContentLength() {
+ HttpServer.bind().then((server) {
+ server.listen(
+ (HttpRequest request) {
+ var response = request.response;
+ Expect.isNull(response.headers.value('content-length'));
+ Expect.equals(-1, response.contentLength);
+ response.headers.set("content-length", 3);
+ Expect.equals("3", response.headers.value('content-length'));
+ Expect.equals(3, response.contentLength);
+ response.addString("xxx");
+ response.close();
+ });
+
+ var client = new HttpClient();
+ client.get("127.0.0.1", server.port, "/")
+ .then((request) => request.close())
+ .then((response) {
+ response.listen(
+ (_) { },
+ onDone: () {
+ client.close();
+ server.close();
+ });
+ });
+ });
+}
+
void main() {
testNoBody(5, false);
testNoBody(5, true);
@@ -239,4 +267,5 @@ void main() {
testBodyChunked(5, false);
testBodyChunked(5, true);
testHttp10();
+ testSetContentLength();
}
« 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