fix(headers): correct order of limit and offset parsing

This commit is contained in:
Hein
2026-06-24 09:47:14 +02:00
parent b9bed67bd7
commit 910390f62d
+5 -4
View File
@@ -225,12 +225,13 @@ func (h *Handler) parseOptionsFromHeaders(r common.Request, model interface{}) E
limitValueParts := strings.Split(limitValue, ",") limitValueParts := strings.Split(limitValue, ",")
if len(limitValueParts) > 1 { if len(limitValueParts) > 1 {
if offset, err := strconv.Atoi(limitValueParts[0]); err == nil { if limit, err := strconv.Atoi(limitValueParts[0]); err == nil {
options.Offset = &offset
}
if limit, err := strconv.Atoi(limitValueParts[1]); err == nil {
options.Limit = &limit options.Limit = &limit
} }
if offset, err := strconv.Atoi(limitValueParts[1]); err == nil {
options.Offset = &offset
}
} else { } else {
if limit, err := strconv.Atoi(limitValueParts[0]); err == nil { if limit, err := strconv.Atoi(limitValueParts[0]); err == nil {
options.Limit = &limit options.Limit = &limit