From 4e83d1a5ce21d88f808ab5be2a60597194ccd5ea Mon Sep 17 00:00:00 2001 From: Code by Ben Date: Mon, 16 Sep 2024 22:09:25 +1000 Subject: [PATCH] page refresh clarity. --- handler/htmx/artifact.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/handler/htmx/artifact.go b/handler/htmx/artifact.go index 0102bca5..80ced914 100644 --- a/handler/htmx/artifact.go +++ b/handler/htmx/artifact.go @@ -33,9 +33,14 @@ var ( ErrYT = errors.New("youtube watch video id needs to be empty or 11 characters") ) -// pageRefresh is a helper function to set the HTTP HTMX header for the browser to refresh the page. +// pageRefresh is a helper function to set the HTTP [HTMX header] for the browser to refresh the page. +// +// [HTMX header]: https://htmx.org/reference/#response_headers func pageRefresh(c echo.Context) echo.Context { - c.Response().Header().Set("HX-Refresh", "true") + res := c.Response() + const htmxRefresh = "HX-Refresh" + res.Header().Set(htmxRefresh, "true") + res.WriteHeader(http.StatusOK) return c }