From 44a4fd7a79ccdcf8883e519c899a5c745a54069d Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Wed, 19 Jun 2019 19:17:45 -0400 Subject: [PATCH] Correctly log and return after serving static file --- handle.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/handle.go b/handle.go index 3acfd08..f7ea69b 100644 --- a/handle.go +++ b/handle.go @@ -437,8 +437,15 @@ func (h *Handler) WebErrors(f handlerFunc, ul UserLevelFunc) http.HandlerFunc { func (h *Handler) CollectionPostOrStatic(w http.ResponseWriter, r *http.Request) { if strings.Contains(r.URL.Path, ".") && !isRaw(r) { + start := time.Now() + status := 200 + defer func() { + log.Info("\"%s %s\" %d %s \"%s\"", r.Method, r.RequestURI, status, time.Since(start), r.UserAgent()) + }() + // Serve static file h.app.App().shttp.ServeHTTP(w, r) + return } h.Web(viewCollectionPost, UserLevelReader)(w, r)