diff --git a/pkg/ast/route/render.go b/pkg/ast/route/render.go index 7fc0d5f..e6640e9 100644 --- a/pkg/ast/route/render.go +++ b/pkg/ast/route/render.go @@ -73,7 +73,16 @@ func Render(path string, routes []RouteDefinition) error { case PositionHeader: return fmt.Sprintf(`Header[%s]("%s")`, item.Type, item.Name), true case PositionCookie: - return fmt.Sprintf(`Cookie%s[%s]("%s")`, isScalarType(item.Type), item.Type, item.Name), true + key := item.Name + if item.Key != "" { + key = item.Key + } + + if item.Type == "string" { + return fmt.Sprintf(`CookieParam("%s")`, key), true + } + + return fmt.Sprintf(`Cookie[%s]("%s")`, item.Type, key), true case PositionBody: return fmt.Sprintf(`Body[%s]("%s")`, item.Type, item.Name), true case PositionPath: diff --git a/templates/project/pkg/f/func.go.tpl b/templates/project/pkg/f/func.go.tpl index cee78bb..b6a5dfe 100644 --- a/templates/project/pkg/f/func.go.tpl +++ b/templates/project/pkg/f/func.go.tpl @@ -4,6 +4,8 @@ import ( "github.com/gofiber/fiber/v3" ) +var Func0 = Func + func Func(f fiber.Handler) fiber.Handler { return f }