API
#net/http/cookiejar
Xu 0.8.8 API
import: #net/http/cookiejar
counts: 2 函数, 3 方法, 2 类型, 0 常量, 0 方法集
内存 Cookie Jar。带 Domain 属性的 cookie 忽略(无公共后缀表)。
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
}
用途
公开结构体 `Cookie`。
参数
name string- 名字
value string- 字段(string)
path string- 文件系统路径
domain string- 字段(string)
secure bool- 字段(bool)
http_only bool- 字段(bool)
max_age int- 字段(int)
struct Jar
pub struct Jar {
pub names []string
pub values []string
pub hosts []string
pub paths []string
pub secures []int
}
用途
公开结构体 `Jar`。
参数
names []string- 字段([]string)
values []string- 字段([]string)
hosts []string- 字段([]string)
paths []string- 字段([]string)
secures []int- 字段([]int)
new_jar
用途
构造 jar。
参数
无
返回
Jar — 该类型的值
(&mut Jar) set_cookie
pub fn (j &mut Jar) set_cookie(u &url.URL, c Cookie)
用途
`&mut Jar` 上的方法:设置 cookie。
参数
j &mut Jar- 接收者 &mut Jar(可变借用)
u &url.URL- u(借用,调用方仍持有;类型 &url.URL)
c Cookie- 字节或字符码(Cookie)
(&Jar) len
pub fn (j &Jar) len() int
用途
`&Jar` 上的方法:返回长度。
参数
j &Jar- 接收者 &Jar(借用)
返回
int — 该类型的值
(&Jar) cookies
pub fn (j &Jar) cookies(u &url.URL) []Cookie
用途
在 `&Jar` 上调用 `cookies`。
参数
j &Jar- 接收者 &Jar(借用)
u &url.URL- u(借用,调用方仍持有;类型 &url.URL)
返回
[]Cookie — 切片结果