...

Source file src/edge-infra.dev/pkg/edge/iam/middleware/context_operation.go

Documentation: edge-infra.dev/pkg/edge/iam/middleware

     1  package middleware
     2  
     3  import (
     4  	"github.com/gin-gonic/gin"
     5  
     6  	"edge-infra.dev/pkg/lib/fog"
     7  )
     8  
     9  // SetOperationInContext adds random operation id to context
    10  func SetOperationInContext() gin.HandlerFunc {
    11  	return func(c *gin.Context) {
    12  		ctx := fog.SetOperationContext(c.Request.Context())
    13  		c.Request = c.Request.WithContext(ctx)
    14  		c.Next()
    15  	}
    16  }
    17  

View as plain text