Skip to content

Commit

Permalink
Update rack requirement from >= 1.5, < 3.1 to >= 1.5, < 3.2 (#431)
Browse files Browse the repository at this point in the history
* Update rack requirement from >= 1.5, < 3.1 to >= 1.5, < 3.2

Updates the requirements on [rack](https://github.com/rack/rack) to permit the latest version.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@1.5.0...v3.1.7)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* don't try to read nil body when unpacking requests
* rack app in test methods should return nil for empty response, not empty array

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: geemus <[email protected]>
  • Loading branch information
dependabot[bot] and geemus authored Oct 10, 2024
1 parent 61c918b commit ad07299
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion committee.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|

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

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

s.add_development_dependency "minitest", "~> 5.3"
Expand Down
1 change: 1 addition & 0 deletions lib/committee/request_unpacker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def unpack_headers(request)
def parse_json(request)
return nil if request.request_method == "GET" && !@allow_get_body

return nil if request.body.nil?
body = request.body.read
# if request body is empty, we just have empty params
return nil if body.length == 0
Expand Down
14 changes: 7 additions & 7 deletions test/test/methods_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def response_data

describe "assert_request_schema_confirm" do
it "passes through a valid request" do
@app = new_rack_app([])
@app = new_rack_app
get "/apps"
assert_request_schema_confirm
end

it "not exist required" do
@app = new_rack_app([])
@app = new_rack_app
get "/search/apps", {}
e = assert_raises(Committee::InvalidRequest) do
assert_request_schema_confirm
Expand All @@ -73,7 +73,7 @@ def response_data
end

it "path undefined in schema" do
@app = new_rack_app([])
@app = new_rack_app
get "/undefined"
e = assert_raises(Committee::InvalidRequest) do
assert_request_schema_confirm
Expand Down Expand Up @@ -146,13 +146,13 @@ def response_data

describe "assert_request_schema_confirm" do
it "passes through a valid request" do
@app = new_rack_app([])
@app = new_rack_app
get "/characters"
assert_request_schema_confirm
end

it "not exist required" do
@app = new_rack_app([])
@app = new_rack_app
get "/validate", {"query_string" => "query", "query_integer_list" => [1, 2]}
e = assert_raises(Committee::InvalidRequest) do
assert_request_schema_confirm
Expand All @@ -162,7 +162,7 @@ def response_data
end

it "path undefined in schema" do
@app = new_rack_app([])
@app = new_rack_app
get "/undefined"
e = assert_raises(Committee::InvalidRequest) do
assert_request_schema_confirm
Expand Down Expand Up @@ -350,7 +350,7 @@ def response_data

private

def new_rack_app(response, headers={ "Content-Type" => "application/json" }, status_code = 200)
def new_rack_app(response = nil, headers={ "Content-Type" => "application/json" }, status_code = 200)
Rack::Builder.new {
run lambda { |_|
[status_code, headers, [response]]
Expand Down

0 comments on commit ad07299

Please sign in to comment.