github.com/msales/pkg/v3@v3.24.0/httpx/middleware/common.go (about)

     1  package middleware
     2  
     3  import (
     4  	"context"
     5  	"net/http"
     6  )
     7  
     8  // WithCommon wraps the handler with the commonly used middlewares.
     9  func WithCommon(ctx context.Context, h http.Handler, fns ...TagsFunc) http.Handler {
    10  	h = WithResponseTime(h, fns...) // Innermost
    11  	h = WithRequestStats(h, fns...)
    12  	h = WithRecovery(h)
    13  	h = WithContext(ctx, h) // Outermost
    14  
    15  	return h
    16  }