package utils import ( "context" "github.com/valyala/fasthttp" ) // SetContextToRequest adds new context to fasthttp request. func SetContextToRequest(ctx context.Context, c *fasthttp.RequestCtx) { c.SetUserValue("context", ctx) } // GetContextFromRequest returns main context from fasthttp request context. func GetContextFromRequest(c *fasthttp.RequestCtx) context.Context { return c.UserValue("context").(context.Context) }