diff options
author | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-09-30 16:02:58 +0300 |
---|---|---|
committer | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-09-30 16:02:58 +0300 |
commit | c84c03d5fecb2214fe8fb43ad740ccf37a967990 (patch) | |
tree | 3244c51a48632070e9bf14ed51757d04556d907c | |
parent | c69313b2ed71fbecd8acca283954dc3cfe424acb (diff) |
Fix returning and calling function
-rw-r--r-- | app.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -184,15 +184,15 @@ func (a *theApp) serveContent(ww http.ResponseWriter, r *http.Request, https boo // Serve static file, applying CORS headers if necessary if a.DisableCrossOriginRequests { - a.serveFileOrNotFound(domain, &w, r) + a.serveFileOrNotFound(domain)(&w, r) } else { - corsHandler.ServeHTTP(&w, r, a.serveFileOrNotFound(domain, &w, r)) + corsHandler.ServeHTTP(&w, r, a.serveFileOrNotFound(domain)) } metrics.ProcessedRequests.WithLabelValues(strconv.Itoa(w.status), r.Method).Inc() } -func (a *theApp) serveFileOrNotFound(domain *domain.D, ww http.ResponseWriter, r *http.Request) http.HandlerFunc { +func (a *theApp) serveFileOrNotFound(domain *domain.D) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { fileServed := domain.ServeFileHTTP(w, r) @@ -202,11 +202,11 @@ func (a *theApp) serveFileOrNotFound(domain *domain.D, ww http.ResponseWriter, r // namespace project is public. if domain.IsNamespaceProject(r) { - if a.Auth.CheckAuthenticationWithoutProject(ww, r) { + if a.Auth.CheckAuthenticationWithoutProject(w, r) { return } - httperrors.Serve404(ww) + httperrors.Serve404(w) return } |