From 8f953dabe53cb4055eea9a59c63a87b5ad192afc Mon Sep 17 00:00:00 2001 From: John Date: Thu, 5 Sep 2019 23:48:54 +0800 Subject: [PATCH] fix issue in ghttp.Session.GetMap* --- .example/other/test.go | 8 +++++--- net/ghttp/ghttp_server_session.go | 16 ++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.example/other/test.go b/.example/other/test.go index 4bdb33247..463496435 100644 --- a/.example/other/test.go +++ b/.example/other/test.go @@ -2,10 +2,12 @@ package main import ( "fmt" - - "github.com/gogf/gf/os/gcmd" + "net/url" ) func main() { - fmt.Println(gcmd.Scan("input:")) + parse1, _ := url.Parse("https://gf.cdn.johng.cn") + parse2, _ := url.Parse("https://gf.cdn.johng.cn/cli/") + fmt.Println(parse1.Host) + fmt.Println(parse2.Host) } diff --git a/net/ghttp/ghttp_server_session.go b/net/ghttp/ghttp_server_session.go index 0bf912af2..ceb3ef29e 100644 --- a/net/ghttp/ghttp_server_session.go +++ b/net/ghttp/ghttp_server_session.go @@ -301,20 +301,20 @@ func (s *Session) GetDuration(key string, def ...interface{}) time.Duration { return gconv.Duration(s.Get(key, def...)) } -func (s *Session) GetMap(value interface{}, tags ...string) map[string]interface{} { - return gconv.Map(value, tags...) +func (s *Session) GetMap(key string, tags ...string) map[string]interface{} { + return gconv.Map(s.Get(key), tags...) } -func (s *Session) GetMapDeep(value interface{}, tags ...string) map[string]interface{} { - return gconv.MapDeep(value, tags...) +func (s *Session) GetMapDeep(key string, tags ...string) map[string]interface{} { + return gconv.MapDeep(s.Get(key), tags...) } -func (s *Session) GetMaps(value interface{}, tags ...string) []map[string]interface{} { - return gconv.Maps(value, tags...) +func (s *Session) GetMaps(key string, tags ...string) []map[string]interface{} { + return gconv.Maps(s.Get(key), tags...) } -func (s *Session) GetMapsDeep(value interface{}, tags ...string) []map[string]interface{} { - return gconv.MapsDeep(value, tags...) +func (s *Session) GetMapsDeep(key string, tags ...string) []map[string]interface{} { + return gconv.MapsDeep(s.Get(key), tags...) } func (s *Session) GetStruct(key string, pointer interface{}, mapping ...map[string]string) error {