From 1d0e201379c4d764fdb9eab5cd7683a7c4b31e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 10 Dec 2019 12:35:07 +0100 Subject: [PATCH] Render proper list responses for users and groups --- pkg/service/v0/graph.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/service/v0/graph.go b/pkg/service/v0/graph.go index 30747dbd65..cb1b9f7fd2 100644 --- a/pkg/service/v0/graph.go +++ b/pkg/service/v0/graph.go @@ -124,7 +124,7 @@ func (g Graph) GetUsers(w http.ResponseWriter, r *http.Request) { } render.Status(r, http.StatusOK) - render.JSON(w, r, users) + render.JSON(w, r, &listResponse{Value: users}) } // GetUser implements the Service interface. @@ -164,7 +164,7 @@ func (g Graph) GetGroups(w http.ResponseWriter, r *http.Request) { } render.Status(r, http.StatusOK) - render.JSON(w, r, groups) + render.JSON(w, r, &listResponse{Value: groups}) } // GetGroup implements the Service interface. @@ -280,3 +280,7 @@ type key int const userIDKey key = 0 const groupIDKey key = 1 + +type listResponse struct { + Value interface{} `json:"value,omitempty"` +}