diff --git a/main_test.go b/main_test.go index ae8575b..e8867ca 100644 --- a/main_test.go +++ b/main_test.go @@ -114,29 +114,29 @@ func TestHTMLHeaderFooter(t *testing.T) { } func sendRequest(req *http.Request) *http.Response { - dir := prepareDirectory("docs") - w := httptest.NewRecorder() - h := &Handler{ - Root: http.Dir(dir), - RootString: dir, - } - h.ServeHTTP(w, req) - resp := w.Result() + dir := prepareDirectory("docs") + w := httptest.NewRecorder() + h := &Handler{ + Root: http.Dir(dir), + RootString: dir, + } + h.ServeHTTP(w, req) + resp := w.Result() + + return resp - return resp - } -func TestBadMethods(t *testing.T){ -methods := []string{"POST", "PUT", "DELETE", "HEAD", - "OPTIONS", "TRACE", "CONNECT", "DUMMY"} -for _, method := range methods { - req, _ := http.NewRequest(method, "/", nil) - resp := sendRequest(req) - if resp.StatusCode != 404 { - t.Log("Expected 404, got:", resp.StatusCode) - t.FailNow() - } +func TestBadMethods(t *testing.T) { + methods := []string{"POST", "PUT", "DELETE", "HEAD", + "OPTIONS", "TRACE", "CONNECT", "DUMMY"} + for _, method := range methods { + req, _ := http.NewRequest(method, "/", nil) + resp := sendRequest(req) + if resp.StatusCode != 404 { + t.Log("Expected 404, got:", resp.StatusCode) + t.FailNow() + } + } } -} \ No newline at end of file