From ac77580cb4ca853cc8393ce68effa051633aa153 Mon Sep 17 00:00:00 2001 From: lalyos Date: Sun, 3 Dec 2023 21:58:03 +0100 Subject: [PATCH] add headers to templated html response --- handlers.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/handlers.go b/handlers.go index 281e4d9..87a748a 100644 --- a/handlers.go +++ b/handlers.go @@ -489,6 +489,10 @@ func writeBasketResponse(w http.ResponseWriter, r *http.Request, name string, ba } // body + data := map[string]interface{}{ + "query":r.URL.Query(), + "headers":r.Header, + } if response.IsTemplate && len(response.Body) > 0 { // template t, err := template.New(name + "-" + r.Method).Parse(response.Body) @@ -499,7 +503,7 @@ func writeBasketResponse(w http.ResponseWriter, r *http.Request, name string, ba // status w.WriteHeader(response.Status) // templated body - t.Execute(w, r.URL.Query()) + t.Execute(w, data) } } else { // status