diff --git a/.example/os/gres/gres_example.go b/.example/os/gres/gres_example.go index 767583927..c2d62108c 100644 --- a/.example/os/gres/gres_example.go +++ b/.example/os/gres/gres_example.go @@ -1,9 +1,10 @@ package main import ( + _ "github.com/gogf/gf/os/gres/testdata/example/boot" + "github.com/gogf/gf/frame/g" "github.com/gogf/gf/net/ghttp" - _ "github.com/gogf/gf/os/gres/testdata/example/boot" ) func main() { diff --git a/database/gdb/gdb_unit_z_mysql_model_test.go b/database/gdb/gdb_unit_z_mysql_model_test.go index eb8a9c5e5..3aaad0ad1 100644 --- a/database/gdb/gdb_unit_z_mysql_model_test.go +++ b/database/gdb/gdb_unit_z_mysql_model_test.go @@ -1263,6 +1263,18 @@ func Test_Model_Where_ISNULL_2(t *testing.T) { t.Assert(result[0]["id"].Int(), 1) }) } + +func Test_Model_Where_GTime(t *testing.T) { + table := createInitTable() + defer dropTable(table) + + gtest.C(t, func(t *gtest.T) { + result, err := db.Table(table).Where("create_time>?", gtime.NewFromStr("2010-09-01")).All() + t.Assert(err, nil) + t.Assert(len(result), 10) + }) +} + func Test_Model_WherePri(t *testing.T) { table := createInitTable() defer dropTable(table) diff --git a/frame/g/g_object.go b/frame/g/g_object.go index 3908ea43b..da846e2ef 100644 --- a/frame/g/g_object.go +++ b/frame/g/g_object.go @@ -20,6 +20,11 @@ import ( "github.com/gogf/gf/os/gview" ) +// Client is a convenience function, that creates and returns a new HTTP client. +func Client() *ghttp.Client { + return ghttp.NewClient() +} + // Server returns an instance of http server with specified name. func Server(name ...interface{}) *ghttp.Server { return gins.Server(name...) diff --git a/net/ghttp/ghttp_client_config.go b/net/ghttp/ghttp_client_config.go index 15bb47522..dc2978a57 100644 --- a/net/ghttp/ghttp_client_config.go +++ b/net/ghttp/ghttp_client_config.go @@ -36,7 +36,7 @@ func NewClient() *Client { return &Client{ Client: http.Client{ Transport: &http.Transport{ - // No validation for https certification of the server. + // No validation for https certification of the server in default. TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, diff --git a/net/ghttp/ghttp_client_request.go b/net/ghttp/ghttp_client_request.go index 40ff8b919..5689b4b3b 100644 --- a/net/ghttp/ghttp_client_request.go +++ b/net/ghttp/ghttp_client_request.go @@ -13,6 +13,7 @@ import ( "fmt" "github.com/gogf/gf/encoding/gparser" "github.com/gogf/gf/text/gregex" + "github.com/gogf/gf/text/gstr" "github.com/gogf/gf/util/gconv" "io" "mime/multipart" @@ -88,7 +89,7 @@ func (c *Client) Trace(url string, data ...interface{}) (*ClientResponse, error) func (c *Client) DoRequest(method, url string, data ...interface{}) (resp *ClientResponse, err error) { method = strings.ToUpper(method) if len(c.prefix) > 0 { - url = c.prefix + url + url = c.prefix + gstr.Trim(url) } param := "" if len(data) > 0 {