Skip to content

Commit

Permalink
Fix use with kwargs
Browse files Browse the repository at this point in the history
Rails also has similar issue and is already fixed in
rails/rails#38091.
  • Loading branch information
kamipo authored and jeremyevans committed Jan 22, 2020
1 parent 75d178c commit f9ef9a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/rack/builder.rb
Expand Up @@ -101,6 +101,7 @@ def use(middleware, *args, &block)
end
@use << proc { |app| middleware.new(app, *args, &block) }
end
ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true)

# Takes an argument that is an object that responds to #call and returns a Rack response.
# The simplest form of this is a lambda object:
Expand Down
4 changes: 2 additions & 2 deletions test/spec_builder.rb
Expand Up @@ -8,7 +8,7 @@
require 'rack/urlmap'

class NothingMiddleware
def initialize(app)
def initialize(app, **)
@app = app
end
def call(env)
Expand Down Expand Up @@ -45,7 +45,7 @@ def builder_to_app(&block)

it "doesn't dupe env even when mapping" do
app = builder_to_app do
use NothingMiddleware
use NothingMiddleware, noop: :noop
map '/' do |outer_env|
run lambda { |inner_env|
inner_env['new_key'] = 'new_value'
Expand Down

0 comments on commit f9ef9a0

Please sign in to comment.