Skip to content

Commit

Permalink
Ensure body is rewound (#425)
Browse files Browse the repository at this point in the history
* Ensure body is rewound
* Remove version constraint
* Declare Rack compatibility
  • Loading branch information
tt committed Jun 17, 2024
1 parent 2a3db6e commit 5e883dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions committee.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Gem::Specification.new do |s|

s.add_dependency "json_schema", "~> 0.14", ">= 0.14.3"

s.add_dependency "rack", ">= 1.5"
s.add_dependency "rack", ">= 1.5", "< 3.1"
s.add_dependency "openapi_parser", "~> 2.0"

s.add_development_dependency "minitest", "~> 5.3"
s.add_development_dependency "rack-test", "~> 0.8"
s.add_development_dependency "rack-test"
s.add_development_dependency "rake", "~> 13.1"
s.add_development_dependency "pry"
s.add_development_dependency "pry-byebug"
Expand Down
6 changes: 5 additions & 1 deletion lib/committee/request_unpacker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ def unpack_request_params(request)
if @allow_form_params && %w[application/x-www-form-urlencoded multipart/form-data].include?(request.media_type)
# Actually, POST means anything in the request body, could be from
# PUT or PATCH too. Silly Rack.
return [request.POST, true] if request.POST
begin
return [request.POST, true] if request.POST
ensure
request.body.rewind
end
end

[{}, false]
Expand Down

0 comments on commit 5e883dd

Please sign in to comment.