intercom-ruby
intercom-ruby copied to clipboard
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
Version info
- intercom-ruby version: 4.1.2
- Ruby version: 2.7.1
Expected behavior
- Should not throw error if server does not return x rate limit reset at date
-
rate_limit_details
should not be set to nil if the http client throws an error
This is the PR solution https://github.com/intercom/intercom-ruby/pull/578
Actual behavior
- If intercom server returns X-RateLimit-Reset as nil it would crash the app
-
rate_limit_details
becomes nil instead of empty hash if the http client throws an error, while the public interface of therate_limit_details
should always be either empty hash or hash with some data.
Steps to reproduce
- X-RateLimit-Reset should not be returned from the server, while
handle_rate_limit
should be enabled. - 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.