kemal/src/kemal/context.cr

17 lines
363 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
getter params
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
end
end