Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
3c92cce9
Commit
3c92cce9
authored
Dec 12, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update httplib to support setcookie
parent
fd78ea5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
README.md
httplib/README.md
+10
-2
httplib.go
httplib/httplib.go
+5
-0
No files found.
httplib/README.md
View file @
3c92cce9
...
...
@@ -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 @
3c92cce9
...
...
@@ -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
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment