some list implemented
This commit is contained in:
@@ -44,8 +44,11 @@ var funcList func() []model.Route = user.Routes.List
|
|||||||
|
|
||||||
func listRoutes(res http.ResponseWriter, req *http.Request) {
|
func listRoutes(res http.ResponseWriter, req *http.Request) {
|
||||||
|
|
||||||
funcList()
|
list := funcList()
|
||||||
res.WriteHeader(http.StatusNotFound)
|
|
||||||
|
listBytes, _ := json.Marshal(list)
|
||||||
|
res.Header().Set("Content-Type", "application/json")
|
||||||
|
res.Write(listBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// user.Routes.Append(r model.Route) model.Route
|
// user.Routes.Append(r model.Route) model.Route
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ func TestAddRouteReturns422ErrorWhenMandatoryFieldsMissing(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddRouteReturnsCreated(t *testing.T) {
|
func TestAddRouteReturnsCreated(t *testing.T) {
|
||||||
t.Skip("****** WIP ******")
|
|
||||||
reqPayload := `{
|
reqPayload := `{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url_pattern": "/hello",
|
"url_pattern": "/hello",
|
||||||
@@ -134,7 +133,6 @@ func TestRemoveRouteReturnsNoContent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListRoutesReturnsEmptyList(t *testing.T) {
|
func TestListRoutesReturnsEmptyList(t *testing.T) {
|
||||||
t.Skip("****** WIP ******")
|
|
||||||
req := httptest.NewRequest(http.MethodGet, "/routes/", nil)
|
req := httptest.NewRequest(http.MethodGet, "/routes/", nil)
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
handler := http.HandlerFunc(listRoutes)
|
handler := http.HandlerFunc(listRoutes)
|
||||||
@@ -155,7 +153,6 @@ func TestListRoutesReturnsEmptyList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListRoutesReturnsTwoElementsList(t *testing.T) {
|
func TestListRoutesReturnsTwoElementsList(t *testing.T) {
|
||||||
t.Skip("****** WIP ******")
|
|
||||||
req := httptest.NewRequest(http.MethodGet, "/routes", nil)
|
req := httptest.NewRequest(http.MethodGet, "/routes", nil)
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
handler := http.HandlerFunc(listRoutes)
|
handler := http.HandlerFunc(listRoutes)
|
||||||
|
|||||||
Reference in New Issue
Block a user