cookies.go 471 字节
Newer Older
E
eoLinker API Management 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
package common

import "net/http"

type CookiesHandler struct {
	req http.Request
}

func (cs *CookiesHandler) AddCookie(c *http.Cookie) {
	cs.req.AddCookie(c)
}

func (cs *CookiesHandler) Cookie(name string) (*http.Cookie, error) {
	return cs.req.Cookie(name)
}

func (cs *CookiesHandler) Cookies() []*http.Cookie {
	return cs.req.Cookies()
}

func newCookieHandle(header http.Header) *CookiesHandler {
	return &CookiesHandler{
		req: http.Request{Header: header},
	}
}