diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 54c062b7..1aa47966 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,8 +16,8 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['3.2', '3.3', '3.4', '4.0', 'jruby-9.3', 'jruby-9.4', 'jruby-10.0'] - es_version: ['8.19.14-SNAPSHOT', '9.2.8-SNAPSHOT', '9.3.3-SNAPSHOT', '9.4.0-SNAPSHOT'] + ruby: ['3.3', '3.4', '4.0', 'jruby-9.3', 'jruby-9.4', 'jruby-10.0'] + es_version: ['8.19.14-SNAPSHOT', '9.3.3-SNAPSHOT', '9.4.0-SNAPSHOT', '9.5.0-SNAPSHOT'] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -54,7 +54,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['3.0', '3.1', '3.2', '3.3', 'jruby-9.3'] + ruby: ['3.3', '3.4', '4.0', 'jruby-9.3', 'jruby-9.4', 'jruby-10.0'] es_version: ['8.19.14-SNAPSHOT'] runs-on: ubuntu-latest steps: diff --git a/Gemfile b/Gemfile index 4c51d07a..898235a8 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,7 @@ group :development, :test do gem 'async-http-faraday' gem 'curb' gem 'faraday-patron' - gem 'oj' + gem 'oj', '>= 3.17.3', '< 4' gem 'debug' end gem 'rspec' diff --git a/Gemfile-faraday1.gemfile b/Gemfile-faraday1.gemfile index 2e075980..889b5b9b 100644 --- a/Gemfile-faraday1.gemfile +++ b/Gemfile-faraday1.gemfile @@ -33,10 +33,11 @@ group :development, :test do if defined?(JRUBY_VERSION) gem 'manticore', platform: :jruby gem 'pry-nav' + gem 'base64' else gem 'curb' gem 'debug' - gem 'oj' + gem 'oj', '>= 3.17.3', '< 4' gem 'patron' end end diff --git a/lib/elastic/transport/client.rb b/lib/elastic/transport/client.rb index cd0dccc7..a3e83a4a 100644 --- a/lib/elastic/transport/client.rb +++ b/lib/elastic/transport/client.rb @@ -169,7 +169,7 @@ def initialize(arguments = {}, &block) def perform_request(method, path, params = {}, body = nil, headers = nil, opts = {}) method = @send_get_body_as if method == 'GET' && body validate_ca_fingerprints if @ca_fingerprint - if @otel + if defined?(@otel) && !@otel.nil? # If no endpoint is specified in the opts, use the HTTP method name span_name = opts[:endpoint] || method @otel.tracer.in_span(span_name) do |span| diff --git a/lib/elastic/transport/transport/base.rb b/lib/elastic/transport/transport/base.rb index 19f8eeac..fb3b1af3 100644 --- a/lib/elastic/transport/transport/base.rb +++ b/lib/elastic/transport/transport/base.rb @@ -356,15 +356,10 @@ def perform_request(method, path, params = {}, body = nil, headers = nil, opts = end if response.body && - !response.body.empty? && - response.headers && - response.headers["content-type"] =~ /json/ - - # Prevent Float value from automatically becoming BigDecimal when using Oj - load_options = {} - load_options[:mode] = :compat if ::MultiJson.adapter.to_s == "MultiJson::Adapters::Oj" - - json = serializer.load(response.body, load_options) + !response.body.empty? && + response.headers && + response.headers['content-type'] =~ /json/ + json = serializer.load(response.body) end took = (json['took'] ? sprintf('%.3fs', json['took'] / 1000.0) : 'n/a') rescue 'n/a' __log_response(method, path, params, body, url, response, json, took, duration) unless ignore.include?(response.status.to_i)