Add support for Grape 2.4 (#93)

* Fix RequestLogger middleware to handle Grape 2.4 breaking chnage

* Make RequestLogger#initialize signature match Grape 2.4

* Update changelog

* Require grape >= 2.4 in gemspec

---------

Co-authored-by: Cedric Darricau <cedricdarricau@gmail.com>
This commit is contained in:
Sami Samhuri 2025-08-07 12:03:04 -07:00 committed by GitHub
parent 5a9ef5d801
commit ed25898685
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View file

@ -2,8 +2,8 @@
## [2.1.2] - Unreleased
### Changed or Fixed or Added
- Your contribution here.
### Changed
- [#93](https://github.com/aserafin/grape_logging/pull/93) RequestLogger middleware to handle Grape 2.4 breaking change - [@devsigner](https://github.com/devsigner) and [@samsonjs](https://github.com/samsonjs).
[2.1.2]: https://github.com/aserafin/grape_logging/compare/v2.1.1...master

View file

@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.add_dependency 'grape', '< 2.4.0'
spec.add_dependency 'grape', '>= 2.4.0'
spec.add_dependency 'rack'
spec.add_development_dependency 'rake', '~> 13.3'

View file

@ -14,7 +14,7 @@ module GrapeLogging
# to use int in parameters
attr_accessor :response_status, :response_body
def initialize(app, options = {})
def initialize(app, **options)
super
@included_loggers = @options[:include] || []

View file

@ -5,7 +5,7 @@ describe GrapeLogging::Middleware::RequestLogger do
let(:env) { { 'action_dispatch.request_id' => 'request-abc123' } }
let(:subject) { request.send(request_method, path, env) }
let(:app) { proc { [status, {}, ['response body']] } }
let(:stack) { described_class.new app, options }
let(:stack) { described_class.new app, **options }
let(:request) { Rack::MockRequest.new(stack) }
let(:options) { { include: [], logger: logger } }
let(:logger) { double('logger') }