Skip to content

Commit e60e2a5

Browse files
authored
Merge pull request #80 from launchdarkly/dr/betterNumberHandling
Better number handling when dealing with response codes.
2 parents fd1fa87 + 7845cad commit e60e2a5

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to the LaunchDarkly Ruby SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
44

5+
## [2.0.6] - 2017-02-10
6+
## Changed
7+
- Improved handling of http status codes that may not be integers.
8+
59
## [2.0.5] - 2017-01-31
610
## Changed
711
- Improved error handling when connected to flag update stream.

lib/ldclient-rb/events.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def post_flushed_events(events)
3434
req.options.timeout = @config.read_timeout
3535
req.options.open_timeout = @config.connect_timeout
3636
end
37-
if res.status / 100 != 2
37+
if res.status < 200 || res.status >= 300
3838
@config.logger.error("[LDClient] Unexpected status code while processing events: #{res.status}")
3939
end
4040
end

lib/ldclient-rb/requestor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def make_request(path)
4444
return nil
4545
end
4646

47-
if res.status / 100 != 2
47+
if res.status < 200 || res.status >= 300
4848
@config.logger.error("[LDClient] Unexpected status code #{res.status}")
4949
return nil
5050
end

0 commit comments

Comments
 (0)