Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
- 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
- Route declaration must start with
/. Fixes #242
- Set default exception Content-Type to text/html. Fixes #202
Kemal::Handler. This change requires that all handlers must inherit from
For example this handler will only work on
/ path. By default the HTTP method is
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).
errorhandler now also yields error. For example you can get the error mesasage like
error 500 do |env, err| err.message end