lib/ldclient-rb/requestor.rb in launchdarkly-server-sdk-6.4.0 vs lib/ldclient-rb/requestor.rb in launchdarkly-server-sdk-7.0.0

- old
+ new

@@ -31,11 +31,11 @@ def request_all_data() all_data = JSON.parse(make_request("/sdk/latest-all"), symbolize_names: true) Impl::Model.make_all_store_data(all_data, @config.logger) end - + def stop begin @http_client.close rescue end @@ -51,15 +51,15 @@ uri = URI(@config.base_uri + path) headers = {} Impl::Util.default_http_headers(@sdk_key, @config).each { |k, v| headers[k] = v } headers["Connection"] = "keep-alive" cached = @cache.read(uri) - if !cached.nil? + unless cached.nil? headers["If-None-Match"] = cached.etag end response = @http_client.request("GET", uri, { - headers: headers + headers: headers, }) status = response.status.code # must fully read body for persistent connections body = response.to_s @config.logger.debug { "[LDClient] Got response from uri: #{uri}\n\tstatus code: #{status}\n\theaders: #{response.headers.to_h}\n\tbody: #{body}" } @@ -70,11 +70,11 @@ if status < 200 || status >= 300 raise UnexpectedResponseError.new(status) end body = fix_encoding(body, response.headers["content-type"]) etag = response.headers["etag"] - @cache.write(uri, CacheEntry.new(etag, body)) if !etag.nil? + @cache.write(uri, CacheEntry.new(etag, body)) unless etag.nil? end body end def fix_encoding(body, content_type) @@ -94,9 +94,9 @@ if fields.count >= 2 && fields[0] == 'charset' charset = fields[1] break end end - return [parts[0], charset] + [parts[0], charset] end end end