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
|
|
|
|
def params
|
2016-02-09 17:11:05 +00:00
|
|
|
@params ||= Kemal::ParamParser.new(@route, @request).parse
|
2016-01-24 10:22:25 +00:00
|
|
|
end
|
2016-01-24 10:52:41 +00:00
|
|
|
|
2016-02-09 15:25:01 +00:00
|
|
|
def redirect(url, status_code = 302)
|
2016-01-24 10:52:41 +00:00
|
|
|
@response.headers.add "Location", url
|
2016-02-09 15:25:01 +00:00
|
|
|
@response.status_code = status_code
|
2016-01-24 10:52:41 +00:00
|
|
|
end
|
2014-07-30 23:50:14 +00:00
|
|
|
end
|
|
|
|
end
|