#net/http/cookiejar
Xu 0.16.0 API
import: #net/http/cookiejar
counts: 2 functions, 3 methods, 2 types, 0 constants, 0 method sets
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
Structure encapsulating name, value, path, domain, secure.
Public fields
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
Structure encapsulating names, values, hosts, paths, secures.
Public fields
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
No arguments are required.
Returns
Jar — a value of this type
($&Jar) set_cookie
pub fn (j $&Jar) set_cookie(u &url.URL, c Cookie)
Purpose
Operation on $&Jar: set cookie.
Parameters
j $&Jar- The
Jar instance used by this call (exclusive borrow).
u &url.URL- u (read-only borrow; caller keeps the original; type &url.URL)
c Cookie- byte or character code (Cookie)
Returns
This call does not return a value.
(&Jar) len
pub fn (j &Jar) len() int
Purpose
Operation on &Jar: return the length.
Parameters
j &Jar- The
Jar instance used by this call (borrow).
Returns
int — a value of this type
(&Jar) cookies
pub fn (j &Jar) cookies(u &url.URL) []Cookie
Purpose
Execute cookies on &Jar.
Parameters
j &Jar- The
Jar instance used by this call (borrow).
u &url.URL- u (read-only borrow; caller keeps the original; type &url.URL)
Returns
[]Cookie — slice result