diff --git a/CHANGELOG.md b/CHANGELOG.md index c39efe19..e3f02bf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the LaunchDarkly Ruby SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). +## [2.0.6] - 2017-02-10 +## Changed +- Improved handling of http status codes that may not be integers. + ## [2.0.5] - 2017-01-31 ## Changed - Improved error handling when connected to flag update stream. diff --git a/lib/ldclient-rb/events.rb b/lib/ldclient-rb/events.rb index 5eb8899f..b26f2722 100644 --- a/lib/ldclient-rb/events.rb +++ b/lib/ldclient-rb/events.rb @@ -34,7 +34,7 @@ def post_flushed_events(events) req.options.timeout = @config.read_timeout req.options.open_timeout = @config.connect_timeout end - if res.status / 100 != 2 + if res.status < 200 || res.status >= 300 @config.logger.error("[LDClient] Unexpected status code while processing events: #{res.status}") end end diff --git a/lib/ldclient-rb/requestor.rb b/lib/ldclient-rb/requestor.rb index 82d522cf..b43cf209 100644 --- a/lib/ldclient-rb/requestor.rb +++ b/lib/ldclient-rb/requestor.rb @@ -44,7 +44,7 @@ def make_request(path) return nil end - if res.status / 100 != 2 + if res.status < 200 || res.status >= 300 @config.logger.error("[LDClient] Unexpected status code #{res.status}") return nil end