diff --git a/transport/grpc/client.go b/transport/grpc/client.go index 93dc4f019..e5f37c9b1 100644 --- a/transport/grpc/client.go +++ b/transport/grpc/client.go @@ -5,7 +5,6 @@ import ( "time" "github.com/go-kratos/kratos/v2/middleware" - "github.com/go-kratos/kratos/v2/middleware/recovery" "github.com/go-kratos/kratos/v2/registry" "github.com/go-kratos/kratos/v2/transport" "github.com/go-kratos/kratos/v2/transport/grpc/resolver/discovery" @@ -85,9 +84,6 @@ func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, func dial(ctx context.Context, insecure bool, opts ...ClientOption) (*grpc.ClientConn, error) { options := clientOptions{ timeout: 500 * time.Millisecond, - middleware: middleware.Chain( - recovery.Recovery(), - ), } for _, o := range opts { o(&options) diff --git a/transport/grpc/server.go b/transport/grpc/server.go index 56ccb2bbe..af76ea0f7 100644 --- a/transport/grpc/server.go +++ b/transport/grpc/server.go @@ -12,7 +12,6 @@ import ( "github.com/go-kratos/kratos/v2/internal/host" "github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/middleware" - "github.com/go-kratos/kratos/v2/middleware/recovery" "github.com/go-kratos/kratos/v2/transport" "google.golang.org/grpc" "google.golang.org/grpc/health" @@ -100,11 +99,8 @@ func NewServer(opts ...ServerOption) *Server { network: "tcp", address: ":0", timeout: 1 * time.Second, - middleware: middleware.Chain( - recovery.Recovery(), - ), - health: health.NewServer(), - log: log.NewHelper(log.DefaultLogger), + health: health.NewServer(), + log: log.NewHelper(log.DefaultLogger), } for _, o := range opts { o(srv) diff --git a/transport/http/handle.go b/transport/http/handle.go index 6296131ed..1034a251d 100644 --- a/transport/http/handle.go +++ b/transport/http/handle.go @@ -11,7 +11,6 @@ import ( "github.com/go-kratos/kratos/v2/errors" "github.com/go-kratos/kratos/v2/internal/httputil" "github.com/go-kratos/kratos/v2/middleware" - "github.com/go-kratos/kratos/v2/middleware/recovery" "github.com/go-kratos/kratos/v2/transport/http/binding" ) @@ -43,10 +42,9 @@ type HandleOptions struct { // Deprecated: use NewHandler instead. func DefaultHandleOptions() HandleOptions { return HandleOptions{ - Decode: DefaultRequestDecoder, - Encode: DefaultResponseEncoder, - Error: DefaultErrorEncoder, - Middleware: recovery.Recovery(), + Decode: DefaultRequestDecoder, + Encode: DefaultResponseEncoder, + Error: DefaultErrorEncoder, } }