switched to gorilla, added out of the box handlers for logging, proxy headers, and recovery

This commit is contained in:
Łukasz Budnik
2021-02-03 09:08:31 +01:00
parent b013a03c8f
commit cd90e887fe
5 changed files with 57 additions and 11 deletions

23
server_test.go Normal file
View File

@@ -0,0 +1,23 @@
package main
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestHandler(t *testing.T) {
req, err := http.NewRequest("GET", "/", nil)
if err != nil {
t.Fatal(err)
}
rr := httptest.NewRecorder()
handler := http.HandlerFunc(handler)
handler.ServeHTTP(rr, req)
if status := rr.Code; status != http.StatusOK {
t.Errorf("handler returned wrong status code: got %v want %v", status, http.StatusOK)
}
}