2016-07-17 15:11:26 +00:00
|
|
|
module Kemal
|
2017-03-03 20:56:29 +00:00
|
|
|
# Kemal::InitHandler is the first handler thus initializes the context with default values.
|
|
|
|
# Such as *Content-Type*, *X-Powered-By* headers.
|
2016-12-24 11:22:44 +00:00
|
|
|
class InitHandler
|
|
|
|
include HTTP::Handler
|
2016-07-17 15:11:26 +00:00
|
|
|
INSTANCE = new
|
|
|
|
|
|
|
|
def call(context)
|
|
|
|
context.response.headers.add "X-Powered-By", "Kemal"
|
2016-07-17 17:23:45 +00:00
|
|
|
context.response.content_type = "text/html" unless context.response.headers.has_key?("Content-Type")
|
2016-07-17 17:42:00 +00:00
|
|
|
call_next context
|
2016-07-17 15:11:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|