|
|
@ -2,7 +2,6 @@ package middleware |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"context" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -22,11 +21,7 @@ func Chain(m ...Middleware) Middleware { |
|
|
|
func HttpMiddleware(c *gin.Context, handler Handler, m ...Middleware) Handler { |
|
|
|
func HttpMiddleware(c *gin.Context, handler Handler, m ...Middleware) Handler { |
|
|
|
opts := []Middleware{Recover(), AddHeaderMdMiddle(c), func(handler Handler) Handler { |
|
|
|
opts := []Middleware{Recover(), AddHeaderMdMiddle(c), func(handler Handler) Handler { |
|
|
|
return func(ctx context.Context, a any) (any, error) { |
|
|
|
return func(ctx context.Context, a any) (any, error) { |
|
|
|
res, err := handler(ctx, a) |
|
|
|
return handler(ctx, a) |
|
|
|
fmt.Println("sss", res) |
|
|
|
|
|
|
|
return &struct { |
|
|
|
|
|
|
|
Name string |
|
|
|
|
|
|
|
}{}, err |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
}} |
|
|
|
opts = append(opts, m...) |
|
|
|
opts = append(opts, m...) |
|
|
|