From 910390f62db9ba7e33cc4eb34519abae3aef955a Mon Sep 17 00:00:00 2001 From: Hein Date: Wed, 24 Jun 2026 09:47:14 +0200 Subject: [PATCH] fix(headers): correct order of limit and offset parsing --- pkg/restheadspec/headers.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/restheadspec/headers.go b/pkg/restheadspec/headers.go index 5cbe8df..536e1af 100644 --- a/pkg/restheadspec/headers.go +++ b/pkg/restheadspec/headers.go @@ -225,12 +225,13 @@ func (h *Handler) parseOptionsFromHeaders(r common.Request, model interface{}) E limitValueParts := strings.Split(limitValue, ",") if len(limitValueParts) > 1 { - if offset, err := strconv.Atoi(limitValueParts[0]); err == nil { - options.Offset = &offset - } - if limit, err := strconv.Atoi(limitValueParts[1]); err == nil { + if limit, err := strconv.Atoi(limitValueParts[0]); err == nil { options.Limit = &limit } + if offset, err := strconv.Atoi(limitValueParts[1]); err == nil { + options.Offset = &offset + } + } else { if limit, err := strconv.Atoi(limitValueParts[0]); err == nil { options.Limit = &limit