From 51b0f8954ccb5d55604cdfb6e2afa0bb22a1457c Mon Sep 17 00:00:00 2001 From: smuralidharan Date: Sun, 13 Jul 2025 16:13:19 -0400 Subject: [PATCH] check existence of expected headers ... do not depend on returned headers such as x-total-pages. It could give raise to false negatives. Given return HTTP return code is good Better for caller to fail on bad return data (if indeed data is bad) than fail to return good data. Signed-off-by: smuralidharan --- src/manetu/gitlab/api.clj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/manetu/gitlab/api.clj b/src/manetu/gitlab/api.clj index 41f253f..e1d40cb 100755 --- a/src/manetu/gitlab/api.clj +++ b/src/manetu/gitlab/api.clj @@ -51,6 +51,8 @@ (m/map-vals #(Integer/parseInt %) $))] (when (and (>= status 200) (< status 400)) (let [acc (concat acc body)] - (if (>= x-page x-total-pages) - acc + (if (or (nil? x-total-pages) (nil? x-page) (>= x-page x-total-pages)) + (do + (log/debug "invoke-allpages complete x-total-pages:" x-total-pages "x-page:" x-page) + acc) (recur acc (inc x-page))))))))