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

#103: Handle pagination on repositories response #160

Merged
merged 1 commit into from
Apr 26, 2020
Merged

Conversation

mc1arke
Copy link
Owner

@mc1arke mc1arke commented Apr 24, 2020

When trying to find authentication tokens for accessing a repository, the list of repositories attached to a token are currently iterated over until one is found with a matching name, or the end of the retrieved list is reached. However, this search is not taking into account pagination in the response from Github, so any list of repositories that is greater than the default page size fails to find a matching authentication token if the repository is not present on the first page of the repository list. To resolve this, the response is checked for a Link header with a rel="next" element, with the link in this header being followed for each response until a matching repository is found, or the header is not present.

@mc1arke mc1arke closed this Apr 26, 2020
@mc1arke mc1arke reopened this Apr 26, 2020
@mc1arke mc1arke force-pushed the issue/103 branch 4 times, most recently from aefbd93 to c5b27cf Compare April 26, 2020 18:03
When trying to find authentication tokens for accessing a repository, the list of repositories attached to a token are currently iterated over until one is found with a matching name, or the end of the retrieved list is reached. However, this search is not taking into account pagination in the response from Github, so any list of repositories that is greater than the default page size fails to find a matching authentication token if the repository is not present on the first page of the repository list. To resolve this, the response is checked for a `Link` header with a `rel="next"` element, with the link in this header being followed for each response until a matching repository is found, or the header is not present.

Includes a drive-by-change to allow correct reporting of test coverage to SonarCloud.
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@mc1arke mc1arke merged commit ae13160 into master Apr 26, 2020
@mc1arke mc1arke deleted the issue/103 branch April 26, 2020 18:12
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.

1 participant