1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-11 04:20:40 +00:00

add comments for testing, utils and validation packages

This commit is contained in:
傅小黑
2014-02-07 16:07:31 +08:00
parent 846d766499
commit ce2984f09a
9 changed files with 64 additions and 7 deletions

View File

@ -8,6 +8,7 @@ import (
var port = ""
var baseUrl = "http://localhost:"
// beego test request client
type TestHttpRequest struct {
httplib.BeegoHttpRequest
}
@ -24,22 +25,27 @@ func getPort() string {
return port
}
// returns test client in GET method
func Get(path string) *TestHttpRequest {
return &TestHttpRequest{*httplib.Get(baseUrl + getPort() + path)}
}
// returns test client in POST method
func Post(path string) *TestHttpRequest {
return &TestHttpRequest{*httplib.Post(baseUrl + getPort() + path)}
}
// returns test client in PUT method
func Put(path string) *TestHttpRequest {
return &TestHttpRequest{*httplib.Put(baseUrl + getPort() + path)}
}
// returns test client in DELETE method
func Delete(path string) *TestHttpRequest {
return &TestHttpRequest{*httplib.Delete(baseUrl + getPort() + path)}
}
// returns test client in HEAD method
func Head(path string) *TestHttpRequest {
return &TestHttpRequest{*httplib.Head(baseUrl + getPort() + path)}
}