diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-03-21 09:06:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-21 09:06:08 -0400 |
commit | fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b (patch) | |
tree | 708faaa67a39648dcd9deab953d836771f531d8f /api4/params.go | |
parent | 4968ef0759087f34c1674a385707f6befef810b7 (diff) | |
download | chat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.tar.gz chat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.tar.bz2 chat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.zip |
Implement GET /audits endpoint for APIv4 (#5779)
* Implement GET /audits endpoint for APIv4
* Fix log unit test
Diffstat (limited to 'api4/params.go')
-rw-r--r-- | api4/params.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/api4/params.go b/api4/params.go index 15f632195..8bb072742 100644 --- a/api4/params.go +++ b/api4/params.go @@ -101,13 +101,13 @@ func ApiParamsFromRequest(r *http.Request) *ApiParams { params.PreferenceName = val } - if val, err := strconv.Atoi(r.URL.Query().Get("page")); err != nil { + if val, err := strconv.Atoi(r.URL.Query().Get("page")); err != nil || val < 0 { params.Page = PAGE_DEFAULT } else { params.Page = val } - if val, err := strconv.Atoi(r.URL.Query().Get("per_page")); err != nil { + if val, err := strconv.Atoi(r.URL.Query().Get("per_page")); err != nil || val < 0 { params.PerPage = PER_PAGE_DEFAULT } else if val > PER_PAGE_MAXIMUM { params.PerPage = PER_PAGE_MAXIMUM |