Skip to content

Commit

Permalink
NOISSUE - Remove content-type check from decodeListUserGroupsRequest (#…
Browse files Browse the repository at this point in the history
…1255)

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
  • Loading branch information
manuio authored Oct 16, 2020
1 parent 3c794d4 commit 86fe3f7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions users/api/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...,
))
Expand Down Expand Up @@ -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...,
))
Expand Down Expand Up @@ -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...,
))
Expand All @@ -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...,
))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 86fe3f7

Please sign in to comment.