From 006c0028106425abb3f718b2e86349dee5b7a2ea Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 26 May 2024 21:43:49 +0200 Subject: Refactor how preprocess functions work a bit --- src/http/http.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/http/http.go') diff --git a/src/http/http.go b/src/http/http.go index 6e57a77..4403a69 100644 --- a/src/http/http.go +++ b/src/http/http.go @@ -126,9 +126,10 @@ type api struct { params Params srv *http.Server - redirectTpl *template.Template - auther Auther - urlBuilder render.URLBuilder + redirectTpl *template.Template + auther Auther + urlBuilder render.URLBuilder + postPreprocessFuncs postPreprocessFuncs } // New initializes and returns a new API instance, including setting up all @@ -156,12 +157,12 @@ func New(params Params) (API, error) { ), } + a.postPreprocessFuncs = newPostPreprocessFuncs(a.urlBuilder) a.redirectTpl = mustParseTpl(template.New(""), "redirect.html") a.srv = &http.Server{Handler: a.handler()} go func() { - err := a.srv.Serve(l) if err != nil && !errors.Is(err, http.ErrServerClosed) { ctx := mctx.WithAnnotator(context.Background(), &a.params) -- cgit v1.2.3