NOISSUE - Fix httputil implementation in users service (#1434)

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
This commit is contained in:
Manuel Imperiale 2021-07-08 16:14:49 +02:00 committed by GitHub
parent af0162f0df
commit bb072b8ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 10 deletions

View File

@ -132,17 +132,14 @@ func decodeViewProfile(_ context.Context, r *http.Request) (interface{}, error)
func decodeListUsers(_ context.Context, r *http.Request) (interface{}, error) { func decodeListUsers(_ context.Context, r *http.Request) (interface{}, error) {
o, err := httputil.ReadUintQuery(r, offsetKey, defOffset) o, err := httputil.ReadUintQuery(r, offsetKey, defOffset)
if err != nil && err != errors.ErrNotFoundParam { if err != nil {
return nil, err return nil, err
} }
l, err := httputil.ReadUintQuery(r, limitKey, defLimit) l, err := httputil.ReadUintQuery(r, limitKey, defLimit)
if err != nil && err != errors.ErrNotFoundParam { if err != nil {
return nil, err return nil, err
} }
if err == errors.ErrNotFoundParam {
l = defLimit
}
e, err := httputil.ReadStringQuery(r, emailKey, "") e, err := httputil.ReadStringQuery(r, emailKey, "")
if err != nil { if err != nil {
@ -232,17 +229,14 @@ func decodePasswordChange(_ context.Context, r *http.Request) (interface{}, erro
func decodeListMembersRequest(_ context.Context, r *http.Request) (interface{}, error) { func decodeListMembersRequest(_ context.Context, r *http.Request) (interface{}, error) {
o, err := httputil.ReadUintQuery(r, offsetKey, defOffset) o, err := httputil.ReadUintQuery(r, offsetKey, defOffset)
if err != nil && err != errors.ErrNotFoundParam { if err != nil {
return nil, err return nil, err
} }
l, err := httputil.ReadUintQuery(r, limitKey, defLimit) l, err := httputil.ReadUintQuery(r, limitKey, defLimit)
if err != nil && err != errors.ErrNotFoundParam { if err != nil {
return nil, err return nil, err
} }
if err == errors.ErrNotFoundParam {
l = defLimit
}
m, err := httputil.ReadMetadataQuery(r, metadataKey, nil) m, err := httputil.ReadMetadataQuery(r, metadataKey, nil)
if err != nil { if err != nil {