shad-go/lectures/06-http/context/httpserver/handler_test.go
Fedor Korotkiy c6d2706ac9 Fix
2021-03-18 17:41:28 +03:00

18 lines
289 B
Go

package httpserver
import (
"net/http/httptest"
"testing"
)
func TestHandlerServeHTTP(t *testing.T) {
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/", nil)
h := handler{}
h.ServeHTTP(w, r)
if w.Code != 200 {
t.Errorf("expected HTTP 200, got: %d", w.Code)
}
}