Render not pass variable if set fiber.Map
Closed this issue ยท 8 comments
vmpartner commented
I am use Jet template
This not work:
err := c.Render("index", fiber.Map{
"qwe": "Hello, World ๐!",
})
This work:
err := c.Render("index", map[string]interface{}{
"qwe": "Hello, World ๐!",
})
huyhvq commented
because in func jetVarMap
Lines 211 to 225 in d8ce3c2
doesn't check type
fiber.Map
so we can fix with:
if binds, ok := binding.(fiber.Map); ok {
//do something
}
but it must import pkg "github.com/gofiber/fiber"
or we can fix it in:
convert bind to map[string]interface
https://github.com/gofiber/fiber/blob/b5645f8f21b159120f4c84dfefe8b5b2327cc5c5/ctx.go#L770
Fenny commented
That would do the trick, I can accept a PR with this fix ๐
fuadarradhi commented
@Fenny , another template need this patch too
Fenny commented
@fuadarradhi, which one?
fuadarradhi commented
@Fenny, django/pongo2 template.
https://github.com/gofiber/template/blob/master/django/django.go#L180-L182
Fenny commented
I will do some testing
Fenny commented
Should be fixed in https://github.com/gofiber/template/releases/tag/v1.5.5 thnx for the report ๐