package middleware_test import ( "bytes" "net/http" "edge-infra.dev/pkg/sds/emergencyaccess/middleware" "github.com/gin-gonic/gin" ) // Gin context from handler function var c *gin.Context func ExampleSetLoggerInContext() { // Running within gin handler function // Create a new outgoing request as part of request handling req, _ := http.NewRequestWithContext(c, "GET", "http://myservice", bytes.NewBuffer([]byte{})) // Extract Correlation ID from context correlationID := middleware.GetCorrelationID(c) // Set correlation ID in appropriate header req.Header.Set(middleware.CorrelationIDKey, correlationID) // do request }