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 documentation URL check #18

Merged
merged 4 commits into from
Dec 11, 2023
Merged

Conversation

zendesk-piotrpawluk
Copy link
Contributor

First of all, thanks for creating and maintaining this library!

Apparently, without warning, GitHub changed error message regarding secondary rate limit again.

From:

https://docs.github.com/free-pro-team@latest/rest/overview/resources-in-the-rest-api#secondary-rate-limits

To:

https://docs.github.com/en/free-pro-team@latest/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits

Which is valid action considering the old one is dead (to be precise: no longer includes rate limit section which was extracted to separate page).

This PR:

  • replaces the URL suffix with the newest one
  • fixes the detection logic from AND to OR - the documentation mentions that it's is performed in case the message or URL changes - which I believe doesn't achieve its goal right now
  • modifies tests to cover all three URLs

To safeguard for the modification of the message or documentation URL, only one part of response (prefix OR suffix) should be used to detect a rate limit - instead of AND.
@gofri
Copy link
Owner

gofri commented Dec 10, 2023

Hey @zendesk-piotrpawluk ,
Thank you for your contribution!

The fix looks awesome, but I'm afraid that it might break compatibility for anyone using it with older GHES versions.
Can you please reduce the suffix to be "secondary-rate-limits"?
We can't tell what URL GitHub will decide to use the next time they change it, but it seems to cover all the cases for now and it feels like it should be flexible enough for the next time too.

Thanks!

p.s. sorry for not getting to it earlier, I'm still on low availability because I'm on reserved duty.
I'll try to check up on it during the next days and approve it from my phone.

@zendesk-piotrpawluk
Copy link
Contributor Author

@gofri No problem at all, be safe!

The fix looks awesome, but I'm afraid that it might break compatibility for anyone using it with older GHES versions.
Can you please reduce the suffix to be "secondary-rate-limits"?

I think the change from AND to OR should prevent breaking compatibility in this case as well but that's a good suggestion. Pushed the change.

@gofri
Copy link
Owner

gofri commented Dec 11, 2023

Perfect! Thank you :)

@gofri gofri merged commit 282e1c0 into gofri:main Dec 11, 2023
2 checks passed
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