-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
allow calling [github] without auth #9427
Conversation
...{ | ||
url, | ||
query, | ||
httpErrorMessages: { 401: 'auth required for graphql api' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The v4/GraphQL API doesn't allow anonymous access - a token is required
@@ -49,7 +49,11 @@ export default class GithubSearch extends GithubAuthV3Service { | |||
}, | |||
}, | |||
schema, | |||
httpErrors: httpErrorsFor('repo not found'), | |||
httpErrors: { | |||
401: 'auth required for search api', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The search API doesn't allow anonymous access - a token is required
'/repos/rust-lang/rust', | ||
{}, | ||
) | ||
expect(res.statusCode).to.equal(200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I was working on this, I realised this test never actually asserted the calls were successful! 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me 👍🏻
Closes #2754
Refs #9386 (comment)
This PR resolves a long-standing issue that even though GitHub allows anonymous access to the v3 API with a reasonable rate limit, you have to set a key locally to do any development on any GitHub badges. The changes in #9386 make it extra desirable to be able to call the GH API without auth if possible.
I've set this PR to run the github test suite. Five of them will fail, but I submitted another PR to fix the tests at #9425 so we could merge that first then rebase this onto it, although I think the integration tests are actually the critical ones here.