Skip to content

Commit

Permalink
feat(ruby): upgrade dependencies & fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiAndreiev committed Aug 21, 2024
1 parent f1a8697 commit de2916b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 55 deletions.
102 changes: 55 additions & 47 deletions packages/ruby/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,69 +8,77 @@ PATH
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.4.4)
hashdiff (1.0.1)
httparty (0.21.0)
bigdecimal (3.1.8)
crack (1.0.0)
bigdecimal
rexml
csv (3.3.0)
diff-lcs (1.5.1)
hashdiff (1.1.1)
httparty (0.22.0)
csv
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
json (2.6.2)
json-schema (2.8.1)
addressable (>= 2.4)
json (2.7.2)
json-schema (5.0.0)
addressable (~> 2.8)
language_server-protocol (3.17.0.3)
mini_mime (1.1.5)
multi_xml (0.6.0)
parallel (1.22.1)
parser (3.1.2.1)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
parallel (1.26.3)
parser (3.3.4.2)
ast (~> 2.4.1)
public_suffix (4.0.6)
rack (2.2.3.1)
rack-test (1.1.0)
rack (>= 1.0, < 3)
racc
public_suffix (6.0.1)
racc (1.8.1)
rack (3.1.7)
rack-test (2.1.0)
rack (>= 1.3)
rainbow (3.1.1)
rake (12.3.3)
regexp_parser (2.5.0)
rexml (3.3.3)
regexp_parser (2.9.2)
rexml (3.3.5)
strscan
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rubocop (1.36.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.65.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.2.1)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
rubocop-performance (1.14.3)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rspec (2.12.1)
rubocop (~> 1.31)
ruby-progressbar (1.11.0)
safe_yaml (1.0.5)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.1)
parser (>= 3.3.1.0)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.4)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
strscan (3.1.0)
unicode-display_width (2.2.0)
webmock (3.8.3)
addressable (>= 2.3.6)
unicode-display_width (2.5.0)
webmock (3.23.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

Expand Down
22 changes: 14 additions & 8 deletions packages/ruby/lib/readme/http_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,9 @@ def headers

def body
if IS_RACK_V3
body = @input.read
@input.rewind
body
read_body(@input)
else
@request.body.rewind
content = @request.body.read
@request.body.rewind

content
read_body(@request.body)
end
end

Expand Down Expand Up @@ -134,5 +128,17 @@ def host_header
'Host' => @request.host
}.compact
end

def read_body(io)
return '' if io.nil?

io.rewind if io.respond_to?(:rewind)
content = io.read || ''
io.rewind if io.respond_to?(:rewind)
content
rescue => e
Readme::Metrics.logger.warn "Error reading request body: #{e.message}"
''
end
end
end

0 comments on commit de2916b

Please sign in to comment.