Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
fix bug in unit test
Browse files Browse the repository at this point in the history
Signed-off-by: yeya24 <yb532204897@gmail.com>
  • Loading branch information
yeya24 authored and lowzj committed Jun 27, 2019
1 parent 379d175 commit 2a431f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions supernode/daemon/util/filter.go
Expand Up @@ -57,14 +57,14 @@ func ParseFilter(req *http.Request, sortKeyMap map[string]bool) (pageFilter *Pag
// pageNum
pageNum, err := stoi(v.Get(PAGENUM))
if err != nil {
return nil, errors.Wrapf(errorType.ErrInvalidValue, "pageNum %s is not a number: %v", pageNum, err)
return nil, errors.Wrapf(errorType.ErrInvalidValue, "pageNum %d is not a number: %v", pageNum, err)
}
pageFilter.PageNum = pageNum

// pageSize
pageSize, err := stoi(v.Get(PAGESIZE))
if err != nil {
return nil, errors.Wrapf(errorType.ErrInvalidValue, "pageSize %s is not a number: %v", pageSize, err)
return nil, errors.Wrapf(errorType.ErrInvalidValue, "pageSize %d is not a number: %v", pageSize, err)
}
pageFilter.PageSize = pageSize

Expand Down Expand Up @@ -105,12 +105,12 @@ func stoi(str string) (int, error) {
func ValidateFilter(pageFilter *PageFilter, sortKeyMap map[string]bool) error {
// pageNum
if pageFilter.PageNum < 0 {
return errors.Wrapf(errorType.ErrInvalidValue, "pageNum %s is not a natural number: %v", pageFilter.PageNum)
return errors.Wrapf(errorType.ErrInvalidValue, "pageNum %d is not a natural number", pageFilter.PageNum)
}

// pageSize
if pageFilter.PageSize < 0 {
return errors.Wrapf(errorType.ErrInvalidValue, "pageSize %s is not a natural number: %v", pageFilter.PageSize)
return errors.Wrapf(errorType.ErrInvalidValue, "pageSize %d is not a natural number", pageFilter.PageSize)
}

// sortDirect
Expand Down

0 comments on commit 2a431f4

Please sign in to comment.