fix: don't attempt to load more than configured number of results
1 file changed, 3 insertions(+), 2 deletions(-)
jump to
M internal/server/mux.go → internal/server/mux.go
@@ -107,7 +107,7 @@ return } if pageNumber == 0 { pageNumber = 1 - pageSize = math.MaxInt + pageSize = config.MaxResultsShowAll } } page := pagination.New(pageNumber, pageSize)@@ -127,7 +127,8 @@ errorHandler(w, r, err.Error(), http.StatusInternalServerError) return } - if pageSize == math.MaxInt && results.Total > config.MaxResultsShowAll { + if pageSize == config.MaxResultsShowAll && + results.Total > config.MaxResultsShowAll { errorHandler(w, r, "Too many results, use pagination", http.StatusBadRequest) }