mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 00:50:54 +00:00
Update README
This commit is contained in:
parent
e70537f8b3
commit
6ae8bc1a16
@ -10,8 +10,8 @@ you can use Get to crawl data.
|
|||||||
|
|
||||||
str, err := httplib.Get("http://beego.me/").String()
|
str, err := httplib.Get("http://beego.me/").String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// error
|
// error
|
||||||
}
|
}
|
||||||
fmt.Println(str)
|
fmt.Println(str)
|
||||||
|
|
||||||
## POST
|
## POST
|
||||||
@ -22,8 +22,8 @@ POST data to remote url
|
|||||||
req.Param("password","123456")
|
req.Param("password","123456")
|
||||||
str, err := req.String()
|
str, err := req.String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// error
|
// error
|
||||||
}
|
}
|
||||||
fmt.Println(str)
|
fmt.Println(str)
|
||||||
|
|
||||||
## Set timeout
|
## Set timeout
|
||||||
@ -33,6 +33,7 @@ The default timeout is `60` seconds, function prototype:
|
|||||||
SetTimeout(connectTimeout, readWriteTimeout time.Duration)
|
SetTimeout(connectTimeout, readWriteTimeout time.Duration)
|
||||||
|
|
||||||
Exmaple:
|
Exmaple:
|
||||||
|
|
||||||
// GET
|
// GET
|
||||||
httplib.Get("http://beego.me/").SetTimeout(100 * time.Second, 30 * time.Second)
|
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
|
## Set HTTP Basic Auth
|
||||||
|
|
||||||
str, err := Get("http://beego.me/").SetBasicAuth("user", "passwd").String()
|
str, err := Get("http://beego.me/").SetBasicAuth("user", "passwd").String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// error
|
// error
|
||||||
}
|
}
|
||||||
fmt.Println(str)
|
fmt.Println(str)
|
||||||
|
|
||||||
## Set HTTPS
|
## Set HTTPS
|
||||||
|
|
||||||
@ -86,8 +87,8 @@ httplib support mutil file upload, use `req.PostFile()`
|
|||||||
req.PostFile("uploadfile1", "httplib.pdf")
|
req.PostFile("uploadfile1", "httplib.pdf")
|
||||||
str, err := req.String()
|
str, err := req.String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// error
|
// error
|
||||||
}
|
}
|
||||||
fmt.Println(str)
|
fmt.Println(str)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user