From 7b96decf175dd1201b49eaad2ec326bfde6b3272 Mon Sep 17 00:00:00 2001 From: emile Date: Wed, 16 Sep 2015 22:41:01 +0200 Subject: [PATCH] note found handler --- traefik.go | 3 ++- web.go | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/traefik.go b/traefik.go index 57f42baca..a52ef92e1 100644 --- a/traefik.go +++ b/traefik.go @@ -170,7 +170,8 @@ func main() { } func notFoundHandler(w http.ResponseWriter, r *http.Request) { - templatesRenderer.HTML(w, http.StatusNotFound, "notFound", nil) + http.NotFound(w, r) + //templatesRenderer.HTML(w, http.StatusNotFound, "notFound", nil) } func LoadDefaultConfig(gloablConfiguration *GlobalConfiguration) *mux.Router { diff --git a/web.go b/web.go index 5fbc5ca0e..04688fe15 100644 --- a/web.go +++ b/web.go @@ -68,7 +68,7 @@ func GetBackendHandler(rw http.ResponseWriter, r *http.Request) { if backend, ok := currentConfiguration.Backends[id]; ok { templatesRenderer.JSON(rw, http.StatusOK, backend) }else{ - templatesRenderer.JSON(rw, http.StatusNotFound, nil) + http.NotFound(rw, r) } } @@ -82,7 +82,7 @@ func GetFrontendHandler(rw http.ResponseWriter, r *http.Request) { if frontend, ok := currentConfiguration.Frontends[id]; ok { templatesRenderer.JSON(rw, http.StatusOK, frontend) }else{ - templatesRenderer.JSON(rw, http.StatusNotFound, nil) + http.NotFound(rw, r) } } @@ -92,7 +92,7 @@ func GetServersHandler(rw http.ResponseWriter, r *http.Request) { if backend, ok := currentConfiguration.Backends[backend]; ok { templatesRenderer.JSON(rw, http.StatusOK, backend.Servers) }else{ - templatesRenderer.JSON(rw, http.StatusNotFound, nil) + http.NotFound(rw, r) } } @@ -104,9 +104,9 @@ func GetServerHandler(rw http.ResponseWriter, r *http.Request) { if server, ok := backend.Servers[server]; ok { templatesRenderer.JSON(rw, http.StatusOK, server) }else{ - templatesRenderer.JSON(rw, http.StatusNotFound, nil) + http.NotFound(rw, r) } }else{ - templatesRenderer.JSON(rw, http.StatusNotFound, nil) + http.NotFound(rw, r) } } \ No newline at end of file