Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type error in ResultPager::fetch #1132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nunoplopes
Copy link

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

Copy link
Collaborator

@acrobat acrobat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nunoplopes thanks for the PR! Can you also add a test for this to avoid any regressions in the future? Thanks!

See: https://github.com/KnpLabs/php-github-api/blob/master/test/Github/Tests/ResultPagerTest.php

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants