From 6f9bbbf41625dd98f56f7ec48a4e6611200eeab6 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 29 Oct 2019 20:15:13 +0800 Subject: [PATCH] add debug info for ghttp.Server --- net/ghttp/ghttp_server_router_serve.go | 3 +-- net/ghttp/ghttp_unit_router_domain_basic_test.go | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/net/ghttp/ghttp_server_router_serve.go b/net/ghttp/ghttp_server_router_serve.go index 460100247..709474728 100644 --- a/net/ghttp/ghttp_server_router_serve.go +++ b/net/ghttp/ghttp_server_router_serve.go @@ -9,7 +9,6 @@ package ghttp import ( "encoding/json" "fmt" - "github.com/gogf/gf/internal/intlog" "strings" "github.com/gogf/gf/container/glist" @@ -31,7 +30,7 @@ func (s *Server) getHandlersWithCache(r *Request) (parsedItems []*handlerParsedI if parsedItems != nil { return &handlerCacheItem{parsedItems, hasHook, hasServe} } - intlog.Printf("cannot find HTTP handler for: %s, %s, %s, %v", r.Method, r.URL.Path, r.GetHost(), s.serveTree) + //intlog.Printf("cannot find HTTP handler for: %s, %s, %s", r.Method, r.URL.Path, r.GetHost()) return nil }, s.config.RouterCacheExpire*1000) if value != nil { diff --git a/net/ghttp/ghttp_unit_router_domain_basic_test.go b/net/ghttp/ghttp_unit_router_domain_basic_test.go index 0d6f4eb6b..42f1ca9d1 100644 --- a/net/ghttp/ghttp_unit_router_domain_basic_test.go +++ b/net/ghttp/ghttp_unit_router_domain_basic_test.go @@ -8,6 +8,7 @@ package ghttp_test import ( "fmt" + "github.com/gogf/gf/internal/intlog" "testing" "time" @@ -334,15 +335,15 @@ func Test_Router_DomainGroup(t *testing.T) { d.Group("/", func(g *ghttp.RouterGroup) { g.Group("/app", func(gApp *ghttp.RouterGroup) { gApp.GET("/{table}/list/{page}.html", func(r *ghttp.Request) { - fmt.Println("/{table}/list/{page}.html") + intlog.Print("/{table}/list/{page}.html") r.Response.Write(r.Get("table"), "&", r.Get("page")) }) gApp.GET("/order/info/{order_id}", func(r *ghttp.Request) { - fmt.Println("/order/info/{order_id}") + intlog.Print("/order/info/{order_id}") r.Response.Write(r.Get("order_id")) }) gApp.DELETE("/comment/{id}", func(r *ghttp.Request) { - fmt.Println("/comment/{id}") + intlog.Print("/comment/{id}") r.Response.Write(r.Get("id")) }) }) @@ -351,6 +352,8 @@ func Test_Router_DomainGroup(t *testing.T) { //s.SetDumpRouteMap(false) s.Start() defer s.Shutdown() + + time.Sleep(100 * time.Millisecond) gtest.Case(t, func() { client1 := ghttp.NewClient() client1.SetPrefix(fmt.Sprintf("http://local:%d", p))