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
6ae8bc1a
authored
2014-08-21 00:08:08 +0800
by
陈小玉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Update README
1 parent
e70537f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
httplib/README.md
httplib/README.md
View file @
6ae8bc1
...
...
@@ -10,8 +10,8 @@ you can use Get to crawl data.
str, err := httplib.Get("http://beego.me/").String()
if err != nil {
// error
}
// error
}
fmt.Println(str)
## POST
...
...
@@ -22,8 +22,8 @@ POST data to remote url
req.Param("password","123456")
str, err := req.String()
if err != nil {
// error
}
// error
}
fmt.Println(str)
## Set timeout
...
...
@@ -32,7 +32,8 @@ The default timeout is `60` seconds, function prototype:
SetTimeout(connectTimeout, readWriteTimeout time.Duration)
Exmaple:
Exmaple:
// GET
httplib.Get("http://beego.me/").SetTimeout(100 * time.Second, 30 * time.Second)
...
...
@@ -49,10 +50,10 @@ If you want to debug the request info, set the debug on
## Set HTTP Basic Auth
str, err := Get("http://beego.me/").SetBasicAuth("user", "passwd").String()
if err != nil {
// error
}
fmt.Println(str)
if err != nil {
// error
}
fmt.Println(str)
## Set HTTPS
...
...
@@ -67,7 +68,7 @@ More info about the `tls.Config` please visit http://golang.org/pkg/crypto/tls/#
some servers need to specify the protocol version of HTTP
httplib.Get("http://beego.me/").SetProtocolVersion("HTTP/1.1")
## Set Cookie
some http request need setcookie. So set it like this:
...
...
@@ -86,8 +87,8 @@ httplib support mutil file upload, use `req.PostFile()`
req.PostFile("uploadfile1", "httplib.pdf")
str, err := req.String()
if err != nil {
// error
}
// error
}
fmt.Println(str)
...
...
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