From 4f55b2c26db6d5d2ebeb028f2d720ec394b82739 Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Fri, 12 Jun 2026 11:41:20 -0400 Subject: [PATCH] Use MultiXML constant to fix deprecation warning from multi_xml 0.9+ Falls back to MultiXml for older versions so no minimum version bump is required. --- lib/httparty/parser.rb | 2 +- spec/httparty/parser_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/httparty/parser.rb b/lib/httparty/parser.rb index 44451ce4..8301b451 100644 --- a/lib/httparty/parser.rb +++ b/lib/httparty/parser.rb @@ -119,7 +119,7 @@ def parse def xml require 'multi_xml' - MultiXml.parse(body) + (defined?(MultiXML) ? MultiXML : MultiXml).parse(body) end UTF8_BOM = "\xEF\xBB\xBF" diff --git a/spec/httparty/parser_spec.rb b/spec/httparty/parser_spec.rb index a23597fc..281ae018 100644 --- a/spec/httparty/parser_spec.rb +++ b/spec/httparty/parser_spec.rb @@ -165,8 +165,9 @@ def self.name HTTParty::Parser.new('body', nil) end - it "parses xml with MultiXml" do - expect(MultiXml).to receive(:parse).with('body') + it "parses xml with MultiXML" do + xml_parser = defined?(MultiXML) ? MultiXML : MultiXml + expect(xml_parser).to receive(:parse).with('body') subject.send(:xml) end