Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters being called regardless the path specified #678

Open
kamk opened this issue Apr 15, 2024 · 0 comments
Open

Filters being called regardless the path specified #678

kamk opened this issue Apr 15, 2024 · 0 comments
Labels

Comments

@kamk
Copy link

kamk commented Apr 15, 2024

Description

When (before|after)_all filter is specified for all paths (no argument) then any subsequent all filters are called ignoring path matching argument.

Steps to Reproduce

require "kemal"

before_all do |env|
  puts "Filter for all requests"
end

before_all "/xxx/*" do |env|
  puts "Filtering /xxx requests"
end

before_all "/yyy/*" do |env|
  puts "Filtering /yyy requests"
end

get "/*" do |env|
  puts "REQ: #{env.request.path}"
end

Kemal.run

Expected behavior:

Request GET /xxx/123 should output:

Filter for all requests
Filtering /xxx requests
REQ: /xxx/123

Actual behavior:

Request GET /xxx/123 outputs:

Filter for all requests
Filtering /xxx requests
Filtering /yyy requests
REQ: /xxx/123

Reproduces how often: ALWAYS

Versions

Crystal 1.11.2 (2024-01-18)
LLVM: 17.0.6
Default target: aarch64-apple-darwin23.4.0

kemal version 1.5.0

@sdogruyol sdogruyol added the bug label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants