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

Response doesn't have api call body if reddit reports no rate limit left, even if api call was successful #48

Open
sesopenko opened this issue Jun 9, 2024 · 0 comments

Comments

@sesopenko
Copy link

When making an api call, if reddit reports there's no rate limit left (ie: you just used up the last api call for the 10 minute period), the library doesn't bother building a response using the response body, instead short circuiting out with a RateLimitError.

It checks the response, but if there is a header from the reddit api saying there's no rate limit remaining, it will return an error. See here:

https://github.com/vartanbeno/go-reddit/blob/master/reddit/reddit.go#L450

It will return an empty response object, without reading any response body from the reddit api, which is a bug. See here:

https://github.com/vartanbeno/go-reddit/blob/master/reddit/reddit.go#L366

It should only return an empty response body if there's no body from reddit. As the rate limit is reduced by each api call for the 10 minute period, the last api call will incorrectly return an error.

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

No branches or pull requests

1 participant