Mercurial > urweb
diff 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 |
line wrap: on
line diff
--- a/tests/cookie.ur Thu Nov 06 12:46:45 2008 -0500 +++ b/tests/cookie.ur Thu Nov 06 14:03:50 2008 -0500 @@ -1,8 +1,22 @@ cookie c : string -fun main () : transaction page = - setCookie c "Hi"; +fun other () = so <- getCookie c; case so of None => return <xml>No cookie</xml> | Some s => return <xml>Cookie: {[s]}</xml> + +structure M = struct + fun aux () = + setCookie c "Hi"; + so <- getCookie c; + case so of + None => return <xml>No cookie</xml> + | Some s => return <xml><body>Cookie: {[s]}<br/> + <a link={other ()}>Other</a></body></xml> +end + +fun main () : transaction page = return <xml><body> + <a link={other ()}>Other</a><br/> + <a link={M.aux ()}>Aux</a><br/> +</body></xml>