mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 20:10:56 +00:00
update httplib to support setcookie
This commit is contained in:
parent
fd78ea5c4a
commit
3c92cce9f4
@ -43,12 +43,20 @@ set post timeout:
|
||||
## debug
|
||||
if you want to debug the request info, set the debug on
|
||||
|
||||
httplib.Get("").Debug(true)
|
||||
httplib.Get("http://beego.me/").Debug(true)
|
||||
|
||||
## support HTTPS client
|
||||
if request url is https. You can set the client support tls:
|
||||
if request url is https. You can set the client support TSL:
|
||||
|
||||
httplib.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
|
||||
|
||||
more info about the tls.Config please visit http://golang.org/pkg/crypto/tls/#Config
|
||||
|
||||
## set cookie
|
||||
some http request need setcookie. So set it like this:
|
||||
|
||||
cookie := &http.Cookie{}
|
||||
cookie.Name = "username"
|
||||
cookie.Value = "astaxie"
|
||||
httplib.Get("http://beego.me/").SetCookie(cookie)
|
||||
|
||||
|
@ -89,6 +89,11 @@ func (b *BeegoHttpRequest) Header(key, value string) *BeegoHttpRequest {
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *BeegoHttpRequest) SetCookie(cookie *http.Cookie) *BeegoHttpRequest {
|
||||
b.req.Header.Add("Set-Cookie", cookie.String())
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *BeegoHttpRequest) Param(key, value string) *BeegoHttpRequest {
|
||||
b.params[key] = value
|
||||
return b
|
||||
|
Loading…
Reference in New Issue
Block a user