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

rate_limit_details open interface could be nil, when it should not be. X-RateLimit-Reset needs a guard if its not returned from server #579

Open
Goran1708 opened this issue Dec 17, 2021 · 0 comments

Comments

@Goran1708
Copy link

Goran1708 commented Dec 17, 2021

Version info

  • intercom-ruby version: 4.1.2
  • Ruby version: 2.7.1

Expected behavior

  1. Should not throw error if server does not return x rate limit reset at date
  2. rate_limit_details should not be set to nil if the http client throws an error

This is the PR solution #578

Actual behavior

  1. If intercom server returns X-RateLimit-Reset as nil it would crash the app
  2. rate_limit_details becomes nil instead of empty hash if the http client throws an error, while the public interface of the rate_limit_details should always be either empty hash or hash with some data.

Steps to reproduce

  1. X-RateLimit-Reset should not be returned from the server, while handle_rate_limit should be enabled.
  2. This is hard to reproduce because http client initial request on line 61 in class Request "response = http.request(net_http_method)" needs to throw an error, which would set rate_limit_details to nil in the Client class.

Logs

Bug regarding rate_limit_details happened to us because we tried to use rate_limit_details for some custom solution's and at one point it became nil which crash our process.

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