v0.17.0
- Reimplemented Request middleware / filter routing.
Now all requests will first go through the Middleware stack then Filters (before_*) and will finally reach the matching route.
Which is illustrated as,
Request -> Middleware -> Filter -> Route
- Rename
return_with
ashalt
. - Route declaration must start with
/
. Fixes #242 - Set default exception Content-Type to text/html. Fixes #202
- Add
only
andexclude
paths forKemal::Handler
. This change requires that all handlers must inherit fromKemal::Handler
.
For example this handler will only work on /
path. By default the HTTP method is GET
.
OnlyHandler < Kemal::Handler
only ["/"]
def call(env)
return call_next(env) unless only_match?(env)
puts "If the path is / i will be doing some processing here."
end
end
The handlers using exclude
will work on the paths that isn't specified. For example this handler will work on any routes other than /
.
ExcludeHandler < Kemal::Handler
exclude ["/"]
def call(env)
return call_next(env) unless only_match?(env)
puts "If the path is NOT / i will be doing some processing here."
end
end
- Close response on
halt
. (thanks @samueleaton). - Update
Radix
tov0.3.4
. error
handler now also yields error. For example you can get the error mesasage like
error 500 do |env, err|
err.message
end
- Update
multipart.cr
tov0.1.1