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:
@ -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)}
|
||||
}
|
||||
|
Reference in New Issue
Block a user