2015-10-29 15:16:29 +00:00
|
|
|
# Context is the environment which holds request/response specific
|
|
|
|
# information such as params, content_type e.g
|
2016-01-24 10:22:25 +00:00
|
|
|
class HTTP::Server
|
|
|
|
class Context
|
|
|
|
getter params
|
2014-07-30 23:50:14 +00:00
|
|
|
|
2016-01-24 10:22:25 +00:00
|
|
|
def params
|
|
|
|
Kemal::ParamParser.new(@route, @request).parse
|
|
|
|
end
|
2016-01-24 10:52:41 +00:00
|
|
|
|
|
|
|
def redirect(url)
|
|
|
|
@response.headers.add "Location", url
|
|
|
|
@response.status_code = 301
|
|
|
|
end
|
2014-07-30 23:50:14 +00:00
|
|
|
end
|
|
|
|
end
|