From 81a702264dd7a3d0f27e0176b862a5ab35db57f7 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol Date: Sat, 24 Dec 2016 14:22:44 +0300 Subject: [PATCH] HTTP::Handler is not a class anymore --- src/kemal/base_log_handler.cr | 4 +++- src/kemal/common_exception_handler.cr | 3 ++- src/kemal/filter_handler.cr | 3 ++- src/kemal/handler.cr | 3 ++- src/kemal/init_handler.cr | 3 ++- src/kemal/route_handler.cr | 3 ++- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/kemal/base_log_handler.cr b/src/kemal/base_log_handler.cr index 05be9d00..a70a9d5b 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 451831a4..5682c549 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 8c19c942..71b06fbe 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 830295a6..15e23b76 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 9a2c304c..322d8f7c 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 3896cc5f..a04da21e 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