Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
3c92cce9
authored
2013-12-12 15:23:17 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update httplib to support setcookie
1 parent
fd78ea5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
httplib/README.md
httplib/httplib.go
httplib/README.md
View file @
3c92cce
...
...
@@ -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)
...
...
httplib/httplib.go
View file @
3c92cce
...
...
@@ -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
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment