kemal/src/kemal/context.cr

15 lines
383 B
Crystal
Raw Normal View History

# 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
def redirect(url, status_code = 302)
2016-01-24 10:52:41 +00:00
@response.headers.add "Location", url
@response.status_code = status_code
2016-01-24 10:52:41 +00:00
end
end
end