ruby-http-client icon indicating copy to clipboard operation
ruby-http-client copied to clipboard

ratelimit methods not working as expected

Open barrettkingram opened this issue 4 years ago • 1 comments

Issue Summary

Response#ratelimit is not working as expected. It just returns nil every time. I believe this is because of a header capitalization mismatch between what that method expects and what is actually returned.

Code Snippet

sendgrid_client = SendGrid::API.new(api_key: SENDGRID_API_KEY).client
data = {automatic_security: true, custom_spf: false, default: false, domain: "my-test-domain.com", subdomain: "abc"}.stringify_keys
response = sendgrid_client.whitelabel.domains.post(request_body: data)

# This returns nil
response.headers["X-RateLimit-Limit"]

# This returns ["1"]
response.headers["x-ratelimit-limit"]

# This returns nil
response.ratelimit

Technical details:

  • ruby-http-client version: 3.5.1
  • ruby version: 2.5

barrettkingram avatar Oct 22 '20 16:10 barrettkingram