glpi: list wrappers reject HTTP 206, GLPI's normal response to a ranged query #807
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The three GLPI list wrappers treat HTTP
206 Partial Contentas a failure. GLPIreturns
206as its normal, successful response to a ranged query, so thesewrappers hard-fail against a perfectly healthy GLPI instance. They are currently
unusable for their primary purpose.
Affected files
packages/mosaic/framework/tools/glpi/ticket-list.sh(line 58)packages/mosaic/framework/tools/glpi/computer-list.sh(line 40)packages/mosaic/framework/tools/glpi/user-list.sh(line 40)All three build a ranged endpoint (
?range=0-${LIMIT}) and then gate on:Because the query is ranged, GLPI answers
206, never200.Reproduce
Against any GLPI instance with credentials configured:
The same request via curl returns
206with a complete, valid JSON array. TheAPI is healthy; only the status-code check is wrong.
Expected vs actual
instance or credentials are broken when neither is.
Fix
Accept
206alongside200in all three:Verified locally: with this change all three wrappers return correct data
(tickets, computers, and users) against a live GLPI instance.
Notes
session-init.shandticket-create.share not affected — they do notissue ranged queries, so
200/201is correct for them.206. A regressiontest asserting
206is treated as success would prevent a recurrence.