Skip to content

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

Description

@Goran1708

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions