diff --git a/internal/health/delivery/http/health_http.go b/internal/health/delivery/http/health_http.go index 143c5fb..3844358 100644 --- a/internal/health/delivery/http/health_http.go +++ b/internal/health/delivery/http/health_http.go @@ -10,14 +10,14 @@ import ( type RequestHandler struct{} func NewRequestHandler() *RequestHandler { - return new(RequestHandler) + return &RequestHandler{} } func (h *RequestHandler) Register(r *router.Router) { - r.GET("/health", h.RequestHandler) + r.GET("/health", h.read) } -func (h *RequestHandler) RequestHandler(ctx *http.RequestCtx) { +func (h *RequestHandler) read(ctx *http.RequestCtx) { ctx.SetContentType(common.MIMETextPlainCharsetUTF8) ctx.SetStatusCode(http.StatusOK) } diff --git a/internal/health/delivery/http/health_http_test.go b/internal/health/delivery/http/health_http_test.go index 6fc88f2..3201832 100644 --- a/internal/health/delivery/http/health_http_test.go +++ b/internal/health/delivery/http/health_http_test.go @@ -9,7 +9,7 @@ import ( http "github.com/valyala/fasthttp" delivery "source.toby3d.me/website/oauth/internal/health/delivery/http" - "source.toby3d.me/website/oauth/internal/util" + "source.toby3d.me/website/oauth/internal/testing/httptest" ) func TestRequestHandler(t *testing.T) { @@ -18,13 +18,11 @@ func TestRequestHandler(t *testing.T) { r := router.New() delivery.NewRequestHandler().Register(r) - client, _, cleanup := util.TestServe(t, r.Handler) + client, _, cleanup := httptest.New(t, r.Handler) t.Cleanup(cleanup) - req := http.AcquireRequest() + req := httptest.NewRequest(http.MethodGet, "https://app.example.com/health", nil) defer http.ReleaseRequest(req) - req.Header.SetMethod(http.MethodGet) - req.SetRequestURI("https://app.example.com/health") resp := http.AcquireResponse() defer http.ReleaseResponse(resp)