Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ jobs:
matrix:
os: [ ubuntu-26.04 ]
rack: [ '~> 2.0', '~> 3.0' ]
ruby: [ 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3 ]
ruby: [ 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3 ]
gemfile: [ Gemfile ]
exclude:
# Rack 3 needs >= Ruby 2.4
- { ruby: 2.2, rack: '~> 3.0' }
- { ruby: 2.3, rack: '~> 3.0' }
runs-on: ${{ matrix.os }}
env:
RACK_VERSION: ${{ matrix.rack }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ have before they can be landed:
place, but if you diverge from how things are done at the moment the patch
won't get accepted as-is.

* Support Ruby 2.2 and higher. We maintain the same Ruby version
* Support Ruby 2.4 and higher. We maintain the same Ruby version
compatibility as Rack itself. We use [GitHub Actions
runs](https://github.com/rack/rack-contrib/actions) to validate this.

Expand Down
10 changes: 1 addition & 9 deletions lib/rack/contrib/json_body_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ class JSONBodyParser
media_type = Rack::MediaType.type(header)
options.any? { |opt| media_type == opt }
},
Regexp => lambda {
if //.respond_to?(:match?)
# Use Ruby's fast regex matcher when available
->(option, header) { option.match? header }
else
# Fall back to the slower matcher for rubies older than 2.4
->(option, header) { option.match header }
end
}.call(),
Regexp => ->(option, header) { option.match? header },
}.freeze

DEFAULT_PARSER = ->(body) { JSON.parse(body, create_additions: false) }
Expand Down
14 changes: 1 addition & 13 deletions lib/rack/contrib/jsonp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ class JSONP

VALID_CALLBACK = /\A[a-zA-Z_$](?:\.?[\w$])*\z/

# These hold the Unicode characters \u2028 and \u2029.
#
# They are defined in constants for Ruby 1.8 compatibility.
#
# In 1.8
# "\u2028" # => "u2028"
# "\u2029" # => "u2029"
# In 1.9
# "\342\200\250" # => "\u2028"
# "\342\200\251" # => "\u2029"
U2028, U2029 = ("\u2028" == 'u2028') ? ["\342\200\250", "\342\200\251"] : ["\u2028", "\u2029"]

HEADERS_KLASS = Rack.release < "3" ? Utils::HeaderHash : Headers
private_constant :HEADERS_KLASS

Expand Down Expand Up @@ -101,7 +89,7 @@ def pad(callback, response)
# replacing them with the escaped version. This should be safe because
# according to the JSON spec, these characters are *only* valid inside
# a string and should therefore not be present any other places.
s.gsub(U2028, '\u2028').gsub(U2029, '\u2029')
s.gsub("\u2028", '\u2028').gsub("\u2029", '\u2029')
end.join

# https://github.com/rack/rack-contrib/issues/46
Expand Down
2 changes: 1 addition & 1 deletion rack-contrib.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |s|

s.extra_rdoc_files = %w[README.md COPYING]

s.required_ruby_version = '>= 2.2.2'
s.required_ruby_version = '>= 2.4'

s.add_runtime_dependency 'rack', '< 4'

Expand Down