Added cookie example to README.

master
vi 2014-08-24 14:00:41 +08:00
parent 19a9a6b40d
commit d75478773f
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,12 @@ used secure HTTP connections when possible."
λ: let Just eff = parseURI "http://www.eff.org/document/eff-and-aclu-amicus-brief-klayman"
λ: rewriteURL eff
Just https://www.eff.org/document/eff-and-aclu-amicus-brief-klayman
λ: :m + Web.Cookie Network.HTTP.Client Data.Time.Clock Control.Applicative
λ: :set -XOverloadedStrings
λ: (now, req) <- (,) <$> getCurrentTime <*> parseUrl "https://github.com"
λ: let (Just gh, Just ck) = (parseURI "https://github.com", generateCookie (def{setCookieDomain=Just "github.com"}) req now True)
λ: rewriteCookie gh ck
Cookie {cookie_name = "name", cookie_value = "value", cookie_expiry_time = 3013-12-25 00:00:00 UTC, cookie_domain = "github.com", cookie_path = "/", cookie_creation_time = 2014-08-24 05:58:20.691866 UTC, cookie_last_access_time = 2014-08-24 05:58:20.691866 UTC, cookie_persistent = False, cookie_host_only = False, cookie_secure_only = True, cookie_http_only = False}
```
[1]: https://www.eff.org/https-everywhere