diff --git a/src/kemal/base_log_handler.cr b/src/kemal/base_log_handler.cr index 05be9d0..a70a9d5 100644 --- a/src/kemal/base_log_handler.cr +++ b/src/kemal/base_log_handler.cr @@ -1,6 +1,8 @@ module Kemal # All loggers must inherit from `Kemal::BaseLogHandler`. - abstract class Kemal::BaseLogHandler < HTTP::Handler + abstract class Kemal::BaseLogHandler + include HTTP::Handler + abstract def call(context) abstract def write(message) end diff --git a/src/kemal/common_exception_handler.cr b/src/kemal/common_exception_handler.cr index 451831a..5682c54 100644 --- a/src/kemal/common_exception_handler.cr +++ b/src/kemal/common_exception_handler.cr @@ -1,6 +1,7 @@ module Kemal # Kemal::CommonExceptionHandler handles all the exceptions including 404, custom errors and 500. - class CommonExceptionHandler < HTTP::Handler + class CommonExceptionHandler + include HTTP::Handler INSTANCE = new def call(context) diff --git a/src/kemal/filter_handler.cr b/src/kemal/filter_handler.cr index 8c19c94..71b06fb 100644 --- a/src/kemal/filter_handler.cr +++ b/src/kemal/filter_handler.cr @@ -1,7 +1,8 @@ module Kemal # Kemal::FilterHandler handle all code that should be evaluated before and after # every request - class FilterHandler < HTTP::Handler + class FilterHandler + include HTTP::Handler INSTANCE = new # This middleware is lazily instantiated and added to the handlers as soon as a call to `after_X` or `before_X` is made. diff --git a/src/kemal/handler.cr b/src/kemal/handler.cr index 830295a..15e23b7 100644 --- a/src/kemal/handler.cr +++ b/src/kemal/handler.cr @@ -1,4 +1,5 @@ -class Kemal::Handler < HTTP::Handler +class Kemal::Handler + include HTTP::Handler @@only_routes_tree = Radix::Tree(String).new @@exclude_routes_tree = Radix::Tree(String).new diff --git a/src/kemal/init_handler.cr b/src/kemal/init_handler.cr index 9a2c304..322d8f7 100644 --- a/src/kemal/init_handler.cr +++ b/src/kemal/init_handler.cr @@ -1,7 +1,8 @@ module Kemal # Kemal::InitHandler is the first handler thus initializes the context with default values such as # Content-Type, X-Powered-By. - class InitHandler < HTTP::Handler + class InitHandler + include HTTP::Handler INSTANCE = new def call(context) diff --git a/src/kemal/route_handler.cr b/src/kemal/route_handler.cr index 3896cc5..a04da21 100644 --- a/src/kemal/route_handler.cr +++ b/src/kemal/route_handler.cr @@ -3,7 +3,8 @@ require "radix" module Kemal # Kemal::RouteHandler is the main handler which handles all the HTTP requests. Routing, parsing, rendering e.g # are done in this handler. - class RouteHandler < HTTP::Handler + class RouteHandler + include HTTP::Handler INSTANCE = new property tree