diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/auth/repo_form.go | 2 | ||||
-rw-r--r-- | modules/git/repo_commit.go | 2 | ||||
-rwxr-xr-x | modules/httplib/README.md | 62 |
3 files changed, 2 insertions, 64 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 1b1a4f7120..3eb0cbc564 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -69,7 +69,7 @@ func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs *binding.Errors, l // \/ \/ \/ \/ \/ \/ type NewWebhookForm struct { - Url string `form:"url" binding:"Required;Url"` + PayloadUrl string `form:"payload_url" binding:"Required;Url"` ContentType string `form:"content_type" binding:"Required"` Secret string `form:"secret"` PushOnly bool `form:"push_only"` diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 0e39963e68..eebe3dd0e0 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -112,7 +112,7 @@ func (repo *Repository) getCommit(id sha1) (*Commit, error) { data, bytErr, err := com.ExecCmdDirBytes(repo.Path, "git", "cat-file", "-p", id.String()) if err != nil { - return nil, errors.New(string(bytErr)) + return nil, errors.New(err.Error() + ": " + string(bytErr)) } commit, err := parseCommitData(data) diff --git a/modules/httplib/README.md b/modules/httplib/README.md deleted file mode 100755 index 95a10d8677..0000000000 --- a/modules/httplib/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# httplib -httplib is an libs help you to curl remote url. - -# How to use? - -## GET -you can use Get to crawl data. - - import "httplib" - - str, err := httplib.Get("http://beego.me/").String() - if err != nil { - t.Fatal(err) - } - fmt.Println(str) - -## POST -POST data to remote url - - b:=httplib.Post("http://beego.me/") - b.Param("username","astaxie") - b.Param("password","123456") - str, err := b.String() - if err != nil { - t.Fatal(err) - } - fmt.Println(str) - -## set timeout -you can set timeout in request.default is 60 seconds. - -set Get timeout: - - httplib.Get("http://beego.me/").SetTimeout(100 * time.Second, 30 * time.Second) - -set post timeout: - - httplib.Post("http://beego.me/").SetTimeout(100 * time.Second, 30 * time.Second) - -- first param is connectTimeout. -- second param is readWriteTimeout - -## debug -if you want to debug the request info, set the debug on - - httplib.Get("http://beego.me/").Debug(true) - -## support HTTPS client -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) - |