Skip to content

Conversation

@nunoplopes
Copy link
Contributor

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 nunoplopes requested a review from acrobat March 25, 2024 09:27
@nunoplopes
Copy link
Contributor Author

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

@acrobat acrobat merged commit 3db6f27 into KnpLabs:master Sep 23, 2024
@acrobat
Copy link
Collaborator

acrobat commented Sep 23, 2024

Thank you @nunoplopes

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.

2 participants