Skip to content

Commit 51b0f89

Browse files
committed
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 <smuralidharan@manetu.com>
1 parent 6b53564 commit 51b0f89

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/manetu/gitlab/api.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
(m/map-vals #(Integer/parseInt %) $))]
5252
(when (and (>= status 200) (< status 400))
5353
(let [acc (concat acc body)]
54-
(if (>= x-page x-total-pages)
55-
acc
54+
(if (or (nil? x-total-pages) (nil? x-page) (>= x-page x-total-pages))
55+
(do
56+
(log/debug "invoke-allpages complete x-total-pages:" x-total-pages "x-page:" x-page)
57+
acc)
5658
(recur acc (inc x-page))))))))

0 commit comments

Comments
 (0)