diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2024-05-26 21:43:49 +0200 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2024-05-26 21:43:49 +0200 |
commit | 006c0028106425abb3f718b2e86349dee5b7a2ea (patch) | |
tree | 47381f28793d97010fe60938eb7684a886dc885b /src/http/http.go | |
parent | 43d8951296ce2f232ca94f0577e2e726291bf783 (diff) |
Refactor how preprocess functions work a bit
Diffstat (limited to 'src/http/http.go')
-rw-r--r-- | src/http/http.go | 9 |
1 files changed, 5 insertions, 4 deletions
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) |