API
Core
Text
IO / OS
Net
Encoding
Crypto
Compress / image / math
Database
External packages
UI
API
#net/http/cookiejar
Xu 0.8.8 API
import: #net/http/cookiejar
counts: 2 fns, 3 methods, 2 types, 0 consts, 0 ifaces
In-memory cookie Jar. Domain-attribute cookies are ignored (no public suffix list).
struct Cookie
pub struct Cookie {
pub name string
pub value string
pub path string
pub domain string
pub secure bool
pub http_only bool
pub max_age int
}
Purpose
`net/http/cookiejar`. In-memory Jar. No PublicSuffixList: Domain attribute cookies are ignored (same as with a nil PSL). Host-only cookies are stored. Path defaults follow RFC 6265 / defaultPath.
Parameters
name string name
value string field (string)
path string filesystem path
domain string field (string)
secure bool field (bool)
http_only bool field (bool)
max_age int field (int)
struct Jar
pub struct Jar {
pub names []string
pub values []string
pub hosts []string
pub paths []string
pub secures []int
}
Purpose
Public struct `Jar`.
Parameters
names []string field ([]string)
values []string field ([]string)
hosts []string field ([]string)
paths []string field ([]string)
secures []int field ([]int)
new_jar
Purpose
Construct jar.
Parameters
none
Returns
Jar — a value of this type
(&mut Jar) set_cookie
pub fn (j &mut Jar) set_cookie(u &url.URL, c Cookie)
Purpose
Method on `&mut Jar`: set cookie.
Parameters
j &mut Jar receiver &mut Jar (exclusive borrow)
u &url.URL u (borrowed; caller keeps it; type &url.URL)
c Cookie byte or character code (Cookie)
(&Jar) len
pub fn (j &Jar) len() int
Purpose
Method on `&Jar`: return the length.
Parameters
j &Jar receiver &Jar (borrow)
Returns
int — a value of this type
(&Jar) cookies
pub fn (j &Jar) cookies(u &url.URL) []Cookie
Purpose
Call `cookies` on `&Jar`.
Parameters
j &Jar receiver &Jar (borrow)
u &url.URL u (borrowed; caller keeps it; type &url.URL)
Returns
[]Cookie — slice result