The function throws "Decoded JSON is not an array or object." at https://github.com/milo/github-api/blob/v1.4.0/src/Github/Api.php#L257 because the actual value of $contents is "" and it does not match is_array() test neither the is_object() test.
I want to issue a Request::HEAD - style request and call some generic GitHub error handler before running my code. How can I do it? Is behavior of decode() designed or it is just a not-yet covered edge case?
Test case:
$api = new Github\Api();
$response = $api->head("/users");
$decoded = $api->decode($response);
Expected result: $decoded contains some empty value
Actual result: exception is thrown