comparison tests/cookie.ur @ 466:1626dcba13ee

Cookies work across pages
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Nov 2008 14:03:50 -0500
parents bb27c7efcd90
children
comparison
equal deleted inserted replaced
465:ddd363e856ff 466:1626dcba13ee
1 cookie c : string 1 cookie c : string
2 2
3 fun main () : transaction page = 3 fun other () =
4 setCookie c "Hi";
5 so <- getCookie c; 4 so <- getCookie c;
6 case so of 5 case so of
7 None => return <xml>No cookie</xml> 6 None => return <xml>No cookie</xml>
8 | Some s => return <xml>Cookie: {[s]}</xml> 7 | Some s => return <xml>Cookie: {[s]}</xml>
8
9 structure M = struct
10 fun aux () =
11 setCookie c "Hi";
12 so <- getCookie c;
13 case so of
14 None => return <xml>No cookie</xml>
15 | Some s => return <xml><body>Cookie: {[s]}<br/>
16 <a link={other ()}>Other</a></body></xml>
17 end
18
19 fun main () : transaction page = return <xml><body>
20 <a link={other ()}>Other</a><br/>
21 <a link={M.aux ()}>Aux</a><br/>
22 </body></xml>