From 522e8205b3a728927d6df6059b79eb7966f1bf95 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 29 May 2020 23:05:37 +0100 Subject: [PATCH] Use the rove package ServerStatus type --- cmd/rove-server/router.go | 8 ++------ cmd/rove-server/router_test.go | 4 +++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/rove-server/router.go b/cmd/rove-server/router.go index 80461c3..5e26886 100644 --- a/cmd/rove-server/router.go +++ b/cmd/rove-server/router.go @@ -5,6 +5,7 @@ import ( "net/http" "github.com/gorilla/mux" + "github.com/mdiluz/rove/pkg/rove" ) func NewRouter() (router *mux.Router) { @@ -17,14 +18,9 @@ func NewRouter() (router *mux.Router) { return } -// RouterStatus is a struct that contains information on the status of the server -type RouterStatus struct { - Ready bool `json:"ready"` -} - // HandleStatus handles HTTP requests to the /status endpoint func HandleStatus(w http.ResponseWriter, r *http.Request) { - var status = RouterStatus{ + var status = rove.ServerStatus{ Ready: true, } diff --git a/cmd/rove-server/router_test.go b/cmd/rove-server/router_test.go index 86714e3..35643c2 100644 --- a/cmd/rove-server/router_test.go +++ b/cmd/rove-server/router_test.go @@ -5,6 +5,8 @@ import ( "net/http" "net/http/httptest" "testing" + + "github.com/mdiluz/rove/pkg/rove" ) func TestHandleStatus(t *testing.T) { @@ -13,7 +15,7 @@ func TestHandleStatus(t *testing.T) { HandleStatus(response, request) - var status RouterStatus + var status rove.ServerStatus json.NewDecoder(response.Body).Decode(&status) if status.Ready != true {