register debug handler

This commit is contained in:
Asim Aslam 2019-12-01 21:04:09 +00:00
parent 795ec509fd
commit 3356b83f24

View File

@ -5,6 +5,7 @@ import (
"context" "context"
"sync" "sync"
proto "github.com/micro/go-micro/debug/proto"
"github.com/micro/go-micro/debug/handler" "github.com/micro/go-micro/debug/handler"
"github.com/micro/go-micro/proxy" "github.com/micro/go-micro/proxy"
"github.com/micro/go-micro/server" "github.com/micro/go-micro/server"
@ -39,11 +40,10 @@ func (s *Server) ServeRequest(ctx context.Context, req server.Request, rsp serve
func New(name string, p proxy.Proxy) *Server { func New(name string, p proxy.Proxy) *Server {
// only register this once // only register this once
once.Do(func() { once.Do(func() {
server.DefaultRouter.Handle( proto.RegisterDebugHandler(
server.DefaultRouter.NewHandler( server.DefaultServer,
handler.DefaultHandler, handler.DefaultHandler,
server.InternalHandler(true), server.InternalHandler(true),
),
) )
}) })