From 403ad1944aa365d55f12c12497704570801f2adb Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Mon, 8 Jul 2024 13:24:09 -0600 Subject: [PATCH 1/4] Push kwargs onto middleware stack --- lib/hanami/api/middleware.rb | 4 ++-- spec/unit/hanami/api/middleware/stack_spec.rb | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/hanami/api/middleware.rb b/lib/hanami/api/middleware.rb index f35ebca..f141f61 100644 --- a/lib/hanami/api/middleware.rb +++ b/lib/hanami/api/middleware.rb @@ -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 diff --git a/spec/unit/hanami/api/middleware/stack_spec.rb b/spec/unit/hanami/api/middleware/stack_spec.rb index a2a8479..b812a15 100644 --- a/spec/unit/hanami/api/middleware/stack_spec.rb +++ b/spec/unit/hanami/api/middleware/stack_spec.rb @@ -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) From 635470e123d2bcd1de3c6c8387c5401d9915305d Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Mon, 8 Jul 2024 13:37:07 -0600 Subject: [PATCH 2/4] Remove CODACY env --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abbde5b..0cb11d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 From 9011c5de467d9db172dc48859362f9d60d3ecdf2 Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Mon, 8 Jul 2024 13:41:22 -0600 Subject: [PATCH 3/4] Use bundler cache --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cb11d7..682fe31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,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 From 0dbbd71878c1dd12237f8056251a90c75d50cb5b Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Mon, 8 Jul 2024 15:26:27 -0600 Subject: [PATCH 4/4] Revert "Remove CODACY env" This reverts commit 635470e123d2bcd1de3c6c8387c5401d9915305d. --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 682fe31..c282640 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,9 @@ 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