From 08cf1264d601e25ed2e90d8c1b37c484e2eec221 Mon Sep 17 00:00:00 2001 From: mrhoribu <15917743+mrhoribu@users.noreply.github.com> Date: Fri, 23 Oct 2026 10:29:17 -0400 Subject: [PATCH] Guard Net::HTTPHeader#content_length spec by net-http version Strict Content-Length parsing came with net-http 0.10.0, not with a Ruby version: Ruby 4.0.x ships net-http 0.9.1 by default, but updating the gem on it brings the strict behavior. Guard on Net::HTTP::VERSION instead. Co-Authored-By: Claude Opus 5.5 --- library/net-http/httpheader/content_length_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/net-http/httpheader/content_length_spec.rb b/library/net-http/httpheader/content_length_spec.rb index 50f01e951..6f96d2d18 100644 --- a/library/net-http/httpheader/content_length_spec.rb +++ b/library/net-http/httpheader/content_length_spec.rb @@ -21,7 +21,7 @@ @headers.content_length.should.eql?(123) end - ruby_version_is ""..."4.1" do + version_is Net::HTTP::VERSION, ""..."0.10.0" do it "ignores the parts of the 'Content-Length' header entry around the digits" do @headers["Content-Length"] = "123valid" @headers.content_length.should.eql?(123) @@ -31,7 +31,7 @@ end end - ruby_version_is "4.1" do + version_is Net::HTTP::VERSION, "0.10.0" do it "raises a Net::HTTPHeaderSyntaxError if the 'Content-Length' header entry is not entirely digits" do @headers["Content-Length"] = "123valid" -> { @headers.content_length }.should.raise(Net::HTTPHeaderSyntaxError)