Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ jobs:
- "3.3"
- "3.2"
- "3.1"
env:
CODACY_RUN_LOCAL: true
CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}}
steps:
- uses: actions/checkout@v1
- name: Install package dependencies
Expand All @@ -36,6 +33,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true # 'bundle install' and cache gems
- name: Install latest bundler
run: |
gem install bundler --no-document
Expand Down
4 changes: 2 additions & 2 deletions lib/hanami/api/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def initialize(prefix)

# @since 0.1.0
# @api private
def use(path, middleware, *args, &blk)
def use(path, middleware, *args, **kwargs, &blk)
# FIXME: test with prefix when Hanami::API.settings and prefix will be supported
@stack[path] ||= []
@stack[path].push([middleware, args, blk])
@stack[path].push([middleware, args, kwargs, blk])
end

# @since 0.1.1
Expand Down
14 changes: 7 additions & 7 deletions spec/unit/hanami/api/middleware/stack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

actual = subject.to_hash
expected = {
"/" => [["elapsed time", [], nil]],
"/admin" => [["elapsed time", [], nil], ["admin auth", [], nil]],
"/api" => [["elapsed time", [], nil], ["rate limiter", [4000], nil]],
"/api/v1" => [["elapsed time", [], nil], ["rate limiter", [4000], nil], ["api v1 auth", ["secret-token"], nil], ["api v1 deprecation", [Date.today], nil]],
"/api/v2" => [["elapsed time", [], nil], ["rate limiter", [4000], nil], ["api v2 auth", [], nil]],
"/:locale" => [["elapsed time", [], nil], ["set locale", [], nil]],
"/:locale/it" => [["elapsed time", [], nil], ["set locale", [], nil], ["analytics", [:it], nil]]
"/" => [["elapsed time", [], {}, nil]],
"/admin" => [["elapsed time", [], {}, nil], ["admin auth", [], {}, nil]],
"/api" => [["elapsed time", [], {}, nil], ["rate limiter", [4000], {}, nil]],
"/api/v1" => [["elapsed time", [], {}, nil], ["rate limiter", [4000], {}, nil], ["api v1 auth", ["secret-token"], {}, nil], ["api v1 deprecation", [Date.today], {}, nil]],
"/api/v2" => [["elapsed time", [], {}, nil], ["rate limiter", [4000], {}, nil], ["api v2 auth", [], {}, nil]],
"/:locale" => [["elapsed time", [], {}, nil], ["set locale", [], {}, nil]],
"/:locale/it" => [["elapsed time", [], {}, nil], ["set locale", [], {}, nil], ["analytics", [:it], {}, nil]]
}

expect(actual).to eq(expected)
Expand Down