From 86fe3f7cdb6c2346f1628e6478854eb3574bc0da Mon Sep 17 00:00:00 2001 From: Manuel Imperiale Date: Fri, 16 Oct 2020 12:54:27 +0200 Subject: [PATCH] NOISSUE - Remove content-type check from decodeListUserGroupsRequest (#1255) Signed-off-by: Manuel Imperiale --- users/api/transport.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/users/api/transport.go b/users/api/transport.go index 58df9640..491e2dff 100644 --- a/users/api/transport.go +++ b/users/api/transport.go @@ -79,7 +79,7 @@ func MakeHandler(svc users.Service, tracer opentracing.Tracer, l log.Logger) htt mux.Get("/users/:userID/groups", kithttp.NewServer( kitot.TraceServer(tracer, "memberships")(listUserGroupsEndpoint(svc)), - decodeListUserGroupRequest, + decodeListUserGroupsRequest, encodeResponse, opts..., )) @@ -114,7 +114,7 @@ func MakeHandler(svc users.Service, tracer opentracing.Tracer, l log.Logger) htt mux.Get("/groups", kithttp.NewServer( kitot.TraceServer(tracer, "groups")(listGroupsEndpoint(svc)), - decodeListUserGroupRequest, + decodeListUserGroupsRequest, encodeResponse, opts..., )) @@ -142,7 +142,7 @@ func MakeHandler(svc users.Service, tracer opentracing.Tracer, l log.Logger) htt mux.Get("/groups/:groupID/users", kithttp.NewServer( kitot.TraceServer(tracer, "members")(listUsersForGroupEndpoint(svc)), - decodeListUserGroupRequest, + decodeListUserGroupsRequest, encodeResponse, opts..., )) @@ -156,7 +156,7 @@ func MakeHandler(svc users.Service, tracer opentracing.Tracer, l log.Logger) htt mux.Get("/groups/:groupID/groups", kithttp.NewServer( kitot.TraceServer(tracer, "list_children_groups")(listGroupsEndpoint(svc)), - decodeListUserGroupRequest, + decodeListUserGroupsRequest, encodeResponse, opts..., )) @@ -284,10 +284,7 @@ func decodeGroupRequest(_ context.Context, r *http.Request) (interface{}, error) return req, nil } -func decodeListUserGroupRequest(_ context.Context, r *http.Request) (interface{}, error) { - if !strings.Contains(r.Header.Get("Content-Type"), contentType) { - return nil, ErrUnsupportedContentType - } +func decodeListUserGroupsRequest(_ context.Context, r *http.Request) (interface{}, error) { o, err := readUintQuery(r, offsetKey, defOffset) if err != nil { return nil, err