add debug info for ghttp.Server

This commit is contained in:
John
2019-10-29 20:15:13 +08:00
parent 143bc3d8e3
commit 6f9bbbf416
2 changed files with 7 additions and 5 deletions

View File

@ -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 {

View File

@ -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))