當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Cookie.Name方法代碼示例

本文整理匯總了Golang中github.com/labstack/echo/engine.Cookie.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Cookie.Name方法的具體用法?Golang Cookie.Name怎麽用?Golang Cookie.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/labstack/echo/engine.Cookie的用法示例。


在下文中一共展示了Cookie.Name方法的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.Name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。