Fix: API not applying query fixed result limit

This commit is contained in:
Gabriel Herbert
2025-01-02 09:03:52 +01:00
parent 20cfe7c6da
commit 83239618e7
+4 -1
View File
@@ -320,6 +320,10 @@ func Handler(w http.ResponseWriter, r *http.Request) {
Offset: getters.offset,
}
if api.Query.FixedLimit != 0 && api.Query.FixedLimit < dataGet.Limit {
dataGet.Limit = api.Query.FixedLimit
}
// abort if requested limit exceeds max limit
// better to abort as smaller than requested result count might suggest the absence of more data
if api.LimitMax < dataGet.Limit {
@@ -380,7 +384,6 @@ func Handler(w http.ResponseWriter, r *http.Request) {
abort(http.StatusServiceUnavailable, nil, err.Error())
return
}
fmt.Println(query)
// parse output
rows := make([]interface{}, 0)