Skip to content

Commit

Permalink
support Rack::Builder signature change on Rack 3
Browse files Browse the repository at this point in the history
  • Loading branch information
sorah committed Mar 21, 2023
1 parent 8b5746b commit c5c7a9e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [Unreleased]

## [0.1.2] - 2023-03-22

- Fixed Apigatewayv2Rack.handler_from_rack_config_file didn't work well with Rack 3.

## [0.1.1] - 2022-10-17

- `#to_ary` on response body is no longer called to support Rack::CommonLogger and keep compatibility with Rack 2 specification.
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
PATH
remote: .
specs:
apigatewayv2_rack (0.1.1)
apigatewayv2_rack (0.1.2)
rack

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.5.0)
rack (3.0.0)
rack (3.0.7)
rake (13.0.6)
rspec (3.11.0)
rspec-core (~> 3.11.0)
Expand Down
7 changes: 6 additions & 1 deletion lib/apigatewayv2_rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def self.generate_handler(app)
def self.handler_from_rack_config_file(path = './config.ru')
require 'rack'
require 'rack/builder'
generate_handler(Rack::Builder.load_file(path, {})[0])
app = if Rack.release[0] == '2'
Rack::Builder.load_file(path, {})[0]
else
Rack::Builder.load_file(path)
end
generate_handler(app)
end
end
2 changes: 1 addition & 1 deletion lib/apigatewayv2_rack/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Apigatewayv2Rack
VERSION = "0.1.1"
VERSION = "0.1.2"
end

0 comments on commit c5c7a9e

Please sign in to comment.