From 8e5f636c095e7740bade2170b300bae310e5e482 Mon Sep 17 00:00:00 2001 From: Achim Rohn Date: Fri, 26 Dec 2025 11:34:57 +0100 Subject: [PATCH] Add GetHeaderValue, as well as req/res getters --- htmx_route.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htmx_route.go b/htmx_route.go index 178cce8..2c35f79 100644 --- a/htmx_route.go +++ b/htmx_route.go @@ -33,12 +33,15 @@ type HtmxContext interface { SetPathTemplate(pathTemplate string) GetPathParam(key string, defaultValue ...string) string GetFormValue(key string) string + GetHeaderValue(key string) string SetHeader(key string, value string) SetAllRoutes(routes []HtmxRoute) GetAllRoutes() []HtmxRoute GetQueryParams() []HtmxPathParam GetAuthContext() (bool, AuthContext) GetGoContext() context.Context + GetRequest() *http.Request + GetResponseWriter() http.ResponseWriter } type HtmxContextImpl struct { @@ -50,6 +53,18 @@ type HtmxContextImpl struct { routes []HtmxRoute } +func (c *HtmxContextImpl) GetResponseWriter() http.ResponseWriter { + return c.res +} + +func (c *HtmxContextImpl) GetRequest() *http.Request { + return c.req +} + +func (c *HtmxContextImpl) GetHeaderValue(key string) string { + return c.req.Header.Get(key) +} + func (c *HtmxContextImpl) GetGoContext() context.Context { return c.req.Context() }