]> git.corax.cc Git - toolbox-restapis/commit
include/gitlab: Make _gitlab_get() and _gitlab_post() handle errors
authorMatthias Kruk <m@m10k.eu>
Mon, 6 Jun 2022 00:06:40 +0000 (09:06 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 6 Jun 2022 00:15:54 +0000 (09:15 +0900)
commit6a30ffd16e3904192256243c43a3573d5bea94c0
tree72e95a9d14e70087b2308fa9e06f377f51833d67
parentd2c874140e481f56abbd625f468323060ce1b118
include/gitlab: Make _gitlab_get() and _gitlab_post() handle errors

When an API call fails, GitLab usually returns HTTP 200 and a JSON
object with an error message. Because HTTP 200 indicates success,
_gitlab_get() and _gitlab_post() assume that the call succeeded and
do not return an error.

This commit modifies _gitlab_get() and _gitlab_post() to check if
the received JSON object contains an "error" member, which should
not be found in any non-error results. If an "error" member was
found, the API call is assumed to have failed.
include/gitlab.sh