From 847167241e9dbe30f8147cd24b6a104a3a56ff74 Mon Sep 17 00:00:00 2001 From: Chapuis Bertil Date: Fri, 18 Sep 2015 13:01:49 +0200 Subject: [PATCH] small changes --- backend/rest_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/rest_test.go b/backend/rest_test.go index 36b513f5a..18fac0b07 100644 --- a/backend/rest_test.go +++ b/backend/rest_test.go @@ -34,11 +34,12 @@ func TestRestBackend(t *testing.T) { os.MkdirAll(filepath.Join(path, d), backend.Modes.Dir) } - r := http.NewServeMux() + router := http.NewServeMux() // Check if a configuration exists. - r.HandleFunc("/config", func(w http.ResponseWriter, r *http.Request) { + router.HandleFunc("/config", func(w http.ResponseWriter, r *http.Request) { method := r.Method + file := filepath.Join(path, "config") _, err := os.Stat(file) @@ -65,9 +66,11 @@ func TestRestBackend(t *testing.T) { }) for _, dir := range dirs { - r.HandleFunc("/"+dir+"/", func(w http.ResponseWriter, r *http.Request) { + router.HandleFunc("/"+dir+"/", func(w http.ResponseWriter, r *http.Request) { method := r.Method + vars := strings.Split(r.RequestURI, "/") + dir := vars[1] name := vars[2] path := filepath.Join(path, dir, name) _, err := os.Stat(path) @@ -115,7 +118,7 @@ func TestRestBackend(t *testing.T) { } // Start the server and launch the tests. - s := httptest.NewServer(r) + s := httptest.NewServer(router) defer s.Close() u, _ := url.Parse(s.URL)