♻️ Updated health route
This commit is contained in:
parent
7c260b0f63
commit
945f0b47dd
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue