php-github-api icon indicating copy to clipboard operation
php-github-api copied to clipboard

Fix type error in ResultPager::fetch

Open nunoplopes opened this issue 1 year ago • 1 comments

When using etags, the reply from github may be empty and the underlying APIs will return an empty string. We need to flip those to empty arrays. e.g.:

$github_builder
  ->addPlugin(new Http\Client\Common\Plugin\HeaderSetPlugin([
    'If-None-Match' => $etag,
  ]));

$api       = $github_client->user('user');
$paginator = new \Github\ResultPager($github_client);
$data      = $paginator->fetch($api, 'events', [$username]);
// $data should be [] if $etag is the latest

nunoplopes avatar Mar 03 '24 15:03 nunoplopes

added tests + redone the fix based on the fix committed for #1135

nunoplopes avatar Mar 25 '24 09:03 nunoplopes

Thank you @nunoplopes

acrobat avatar Sep 23 '24 18:09 acrobat