本文整理汇总了Golang中github.com/labstack/echo/engine.Cookie类的典型用法代码示例。如果您正苦于以下问题:Golang Cookie类的具体用法?Golang Cookie怎么用?Golang Cookie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cookie类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: CookieTest
func CookieTest(t *testing.T, coockie engine.Cookie) {
assert.Equal(t, "github.com", coockie.Domain())
assert.Equal(t, time.Date(2016, time.January, 1, 0, 0, 0, 0, time.UTC), coockie.Expires())
assert.True(t, coockie.HTTPOnly())
assert.True(t, coockie.Secure())
assert.Equal(t, "session", coockie.Name())
assert.Equal(t, "/", coockie.Path())
assert.Equal(t, "securetoken", coockie.Value())
}
开发者ID:o1egl,项目名称:echo,代码行数:9,代码来源:test_helpers.go
示例2: SetCookie
// SetCookie implements `engine.Response#SetCookie` function.
func (r *Response) SetCookie(c engine.Cookie) {
cookie := new(fasthttp.Cookie)
cookie.SetKey(c.Name())
cookie.SetValue(c.Value())
cookie.SetPath(c.Path())
cookie.SetDomain(c.Domain())
cookie.SetExpire(c.Expires())
cookie.SetSecure(c.Secure())
cookie.SetHTTPOnly(c.HTTPOnly())
r.Response.Header.SetCookie(cookie)
}
开发者ID:efimovalex,项目名称:EventKitAPI,代码行数:12,代码来源:response.go
示例3: SetCookie
// SetCookie implements `engine.Response#SetCookie` function.
func (r *Response) SetCookie(c engine.Cookie) {
http.SetCookie(r.ResponseWriter, &http.Cookie{
Name: c.Name(),
Value: c.Value(),
Path: c.Path(),
Domain: c.Domain(),
Expires: c.Expires(),
Secure: c.Secure(),
HttpOnly: c.HTTPOnly(),
})
}
开发者ID:ZloyDyadka,项目名称:echo,代码行数:12,代码来源:response.go
注:本文中的github.com/labstack/echo/engine.Cookie类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论