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 ad891b153b7afd1b74d3e479ad2666ef95f7e8d6..308795a389b84aa96b401d72e39149f137c526f4 100644 |
--- a/tests/standalone/io/http_headers_test.dart |
+++ b/tests/standalone/io/http_headers_test.dart |
@@ -366,67 +366,64 @@ void testCookie() { |
Cookie cookie; |
cookie = new Cookie(name, value); |
- Expect.equals("$name=$value", cookie.toString()); |
+ Expect.equals("$name=$value; HttpOnly", cookie.toString()); |
DateTime date = new DateTime.utc(2014, DateTime.JANUARY, 5, 23, 59, 59, 0); |
cookie.expires = date; |
checkCookie(cookie, "$name=$value" |
- "; Expires=Sun, 05 Jan 2014 23:59:59 GMT"); |
+ "; Expires=Sun, 05 Jan 2014 23:59:59 GMT" |
+ "; HttpOnly"); |
cookie.maxAge = 567; |
checkCookie(cookie, "$name=$value" |
"; Expires=Sun, 05 Jan 2014 23:59:59 GMT" |
- "; Max-Age=567"); |
+ "; Max-Age=567" |
+ "; HttpOnly"); |
cookie.domain = "example.com"; |
checkCookie(cookie, "$name=$value" |
"; Expires=Sun, 05 Jan 2014 23:59:59 GMT" |
"; Max-Age=567" |
- "; Domain=example.com"); |
+ "; Domain=example.com" |
+ "; HttpOnly"); |
cookie.path = "/xxx"; |
checkCookie(cookie, "$name=$value" |
"; Expires=Sun, 05 Jan 2014 23:59:59 GMT" |
"; Max-Age=567" |
"; Domain=example.com" |
- "; Path=/xxx"); |
+ "; Path=/xxx" |
+ "; HttpOnly"); |
cookie.secure = true; |
checkCookie(cookie, "$name=$value" |
"; Expires=Sun, 05 Jan 2014 23:59:59 GMT" |
"; Max-Age=567" |
"; Domain=example.com" |
"; Path=/xxx" |
- "; Secure"); |
- cookie.httpOnly = true; |
+ "; Secure" |
+ "; HttpOnly"); |
+ cookie.httpOnly = false; |
checkCookie(cookie, "$name=$value" |
"; Expires=Sun, 05 Jan 2014 23:59:59 GMT" |
"; Max-Age=567" |
"; Domain=example.com" |
"; Path=/xxx" |
- "; Secure" |
- "; HttpOnly"); |
+ "; Secure"); |
cookie.expires = null; |
checkCookie(cookie, "$name=$value" |
"; Max-Age=567" |
"; Domain=example.com" |
"; Path=/xxx" |
- "; Secure" |
- "; HttpOnly"); |
+ "; Secure"); |
cookie.maxAge = null; |
checkCookie(cookie, "$name=$value" |
"; Domain=example.com" |
"; Path=/xxx" |
- "; Secure" |
- "; HttpOnly"); |
+ "; Secure"); |
cookie.domain = null; |
checkCookie(cookie, "$name=$value" |
"; Path=/xxx" |
- "; Secure" |
- "; HttpOnly"); |
+ "; Secure"); |
cookie.path = null; |
checkCookie(cookie, "$name=$value" |
- "; Secure" |
- "; HttpOnly"); |
+ "; Secure"); |
cookie.secure = false; |
- checkCookie(cookie, "$name=$value" |
- "; HttpOnly"); |
- cookie.httpOnly = false; |
checkCookie(cookie, "$name=$value"); |
} |
test("name", "value"); |
@@ -499,6 +496,17 @@ void testInvalidFieldValue() { |
test(new StringBuffer('\x00'), remove: false); |
} |
+void testClear() { |
+ _HttpHeaders headers = new _HttpHeaders("1.1"); |
+ headers.add("a", "b"); |
+ headers.contentLength = 7; |
+ headers.chunkedTransferEncoding = true; |
+ headers.clear(); |
+ Expect.isNull(headers["a"]); |
+ Expect.equals(headers.contentLength, -1); |
+ Expect.isFalse(headers.chunkedTransferEncoding); |
+} |
+ |
main() { |
testMultiValue(); |
testDate(); |
@@ -514,4 +522,5 @@ main() { |
testHeaderLists(); |
testInvalidFieldName(); |
testInvalidFieldValue(); |
+ testClear(); |
} |