Created
May 7, 2017 06:39
-
-
Save elorest/dd6dbf800f692b1052dedc4f497bf7c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "http" | |
require "./*" | |
module Amber::Controller | |
class Base | |
include Render | |
include Redirect | |
include Callbacks | |
protected getter request = HTTP::Request.new("GET", "/") | |
protected getter response = HTTP::Server::Response.new(IO::Memory.new) | |
protected getter raw_params = HTTP::Params.parse("") | |
protected getter context : HTTP::Server::Context? | |
protected getter params : Amber::Validators::Params = Amber::Validators::Params.new(HTTP::Params.parse("t=t")) | |
def initialize(@context : HTTP::Server::Context) | |
set_context(@context.not_nil!) | |
end | |
def initialize | |
end | |
def set_context(@context : HTTP::Server::Context) | |
@request = context.request | |
@response = context.response | |
@raw_params = context.params | |
@params = Amber::Validators::Params.new(@raw_params) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment