1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-26 17:44:12 +00:00

Update README

This commit is contained in:
陈小玉 2014-08-21 00:08:08 +08:00
parent e70537f8b3
commit 6ae8bc1a16

View File

@ -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
@ -33,6 +33,7 @@ The default timeout is `60` seconds, function prototype:
SetTimeout(connectTimeout, readWriteTimeout time.Duration)
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
@ -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)