pusher / pusher-http-ruby

Ruby library for Pusher Channels HTTP API
https://pusher.com/channels
MIT License
664 stars 123 forks source link

Cluster should only override default if non-nil #157

Closed gorner closed 3 years ago

gorner commented 4 years ago

https://github.com/pusher/pusher-http-ruby/blob/master/lib/pusher/client.rb#L38:

if options.has_key?(:host)
  merged_options[:host] = options[:host]
elsif options.has_key?(:cluster)
  merged_options[:host] = "api-#{options[:cluster]}.pusher.com"
else
  merged_options[:host] = "api.pusherapp.com"
end

The result of this is if an app attempts to pull a cluster from a config but it was not set (i.e. if it's a local config file that hasn't been updated yet), the app will attempt to make requests to api-.pusher.com.

The elsif should instead check that options[:cluster] is non-nil before using it.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you'd like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you.

elverkilde commented 3 years ago

Sorry about that, I just enabled stalebot, but I am looking into this issue.

elverkilde commented 3 years ago

This was fixed in #170 and released as part of the latest release, 2.0.0.