about summary refs log tree commit diff stats
path: root/test/net/cookie.http
blob: c02f7efa21cad6f6c21df00346d0f2ecb4575e0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Content-Type: text/html
Set-Cookie: test=asdfasdf; Max-Age=123123123; Path=/headers
Set-Cookie: SID=31d4d96e407aad42
Set-Cookie: test2=asdfasdf; Max-Age=0
Set-Cookie: test3=x
Set-Cookie: test4=y; Max-Age=
Set-Cookie: test5=; Domain=test.example
Set-Cookie: test6=hi; Max-Age=9223372036854775807
Set-Cookie: test7=hi; Expires=Mon 0 Jan 1999 20:30:00 GMT
Set-Cookie: test8=hi; Expires=Mon, 31 Feb 1999 20:30:00 GMT
Set-Cookie: test10=invalid; Domain=localhost:12345
Set-Cookie: test11=valid; Domain=localhost

<link rel=stylesheet href=cookie.css.http>
<div id=x>Fail</div>
<div id=y>CSS fail</div>
<script src=asserts.js></script>
<script>
const x = new XMLHttpRequest();
x.open("GET", "headers", false);
x.overrideMimeType("text/plain");
x.send();
const cookie = x.responseText.split('\n').find(x => x.startsWith("cookie:"));
assertEquals(cookie.split(': ').pop(), "test=asdfasdf; SID=31d4d96e407aad42; test3=x; test4=y; test6=hi; test7=hi; test8=hi; test11=valid; test9=css");
document.getElementById("x").textContent = "Success";
</script>