From 0d373ebe57bea3f23b17f14cfde2f40157d6888e Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Thu, 21 Dec 2023 14:17:19 +0000 Subject: [PATCH] bug: fixup use of fiber context values ref https://docs.gofiber.io/#zero-allocation --- examples/htmx-fiber-todo/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/htmx-fiber-todo/main.go b/examples/htmx-fiber-todo/main.go index 9320eaa..6759b3a 100644 --- a/examples/htmx-fiber-todo/main.go +++ b/examples/htmx-fiber-todo/main.go @@ -8,6 +8,7 @@ import ( "github.com/chasefleming/elem-go/attrs" "github.com/chasefleming/elem-go/styles" "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/utils" ) // Todo model @@ -54,7 +55,7 @@ func toggleTodoRoute(c *fiber.Ctx) error { } func addTodoRoute(c *fiber.Ctx) error { - newTitle := c.FormValue("newTodo") + newTitle := utils.CopyString(c.FormValue("newTodo")) if newTitle != "" { todos = append(todos, Todo{ID: len(todos) + 1, Title: newTitle, Done: false}) }