Remove redundat http require and move it to kemal.cr
This commit is contained in:
parent
d11b702ee4
commit
6ffa4af0e1
4 changed files with 10 additions and 15 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
require "http"
|
||||||
require "./kemal/*"
|
require "./kemal/*"
|
||||||
require "./kemal/helpers/*"
|
require "./kemal/helpers/*"
|
||||||
require "./kemal/middleware/*"
|
require "./kemal/middleware/*"
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
require "http"
|
|
||||||
|
|
||||||
# All loggers must inherit from `Kemal::BaseLogHandler`.
|
# All loggers must inherit from `Kemal::BaseLogHandler`.
|
||||||
class Kemal::BaseLogHandler < HTTP::Handler
|
class Kemal::BaseLogHandler < HTTP::Handler
|
||||||
def initialize
|
def initialize
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
require "http"
|
|
||||||
|
|
||||||
class Kemal::CommonLogHandler < Kemal::BaseLogHandler
|
class Kemal::CommonLogHandler < Kemal::BaseLogHandler
|
||||||
@handler : IO::FileDescriptor
|
@handler : IO::FileDescriptor
|
||||||
getter handler
|
getter handler
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require "secure_random"
|
require "secure_random"
|
||||||
require "http"
|
|
||||||
|
|
||||||
module Kemal::Middleware
|
module Kemal::Middleware
|
||||||
# This middleware adds CSRF protection to your application.
|
# This middleware adds CSRF protection to your application.
|
||||||
|
@ -12,7 +11,7 @@ module Kemal::Middleware
|
||||||
#
|
#
|
||||||
class CSRF < HTTP::Handler
|
class CSRF < HTTP::Handler
|
||||||
HEADER = "X_CSRF_TOKEN"
|
HEADER = "X_CSRF_TOKEN"
|
||||||
ALLOWED_METHODS = %w[GET HEAD OPTIONS TRACE]
|
ALLOWED_METHODS = %w(GET HEAD OPTIONS TRACE)
|
||||||
PARAMETER_NAME = "authenticity_token"
|
PARAMETER_NAME = "authenticity_token"
|
||||||
|
|
||||||
def call(context)
|
def call(context)
|
||||||
|
@ -41,6 +40,5 @@ module Kemal::Middleware
|
||||||
context.response.print "Forbidden"
|
context.response.print "Forbidden"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue