class Amber::Router::Params

Defined in:

amber/router/params.cr

Constant Summary

APPLICATION_JSON = "application/json"
MULTIPART_FORM = "multipart/form-data"
TYPE_EXT_REGEX = Amber::Support::MimeTypes::TYPE_EXT_REGEX
URL_ENCODED_FORM = "application/x-www-form-urlencoded"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(request : HTTP::Request) #

[View source]

Class Method Detail

def self.media_type?(content_type : String | Nil, expected : String) : Bool #

Whether content_type's media type, the part before any ; parameters, is expected, compared without regard to letter case. Application/X-WWW-Form-Urlencoded; charset=utf-8 is a URL-encoded form; application/x-www-form-urlencodedx is not.


[View source]

Instance Method Detail

def [](key : Types::Key) : String #

[View source]
def []=(key : Types::Key, value) #

[View source]
def []?(key : Types::Key) #

[View source]
def delete_uploaded_files : Nil #

Deletes the tempfiles behind #files and the multipart body copy, if the body was parsed, then empties #files. It reads only what was already parsed, so it never parses a body itself. A file that cannot be deleted is logged and kept for Amber::Router::File.retry_leftover_deletions, so the rest are still removed and the request's own error, if any, is kept.


[View source]
def fetch_all(key : Types::Key) : Array #

[View source]
def files #

[View source]
def form_params : HTTP::Params #

Returns parsed URL-encoded form parameters, reusing the cached body parse. Schema request parsing uses this after routing has inspected _method.


[View source]
def has_key?(key : Types::Key) : Bool #

[View source]
def json(key : Types::Key) #

[View source]
def multipart_params : Types::Params #

Returns parsed multipart fields, reusing the cached body parse.


[View source]
def override_method?(key : Types::Key) #

[View source]
def to_h : Types::Params #

[View source]
def url_encoded_form? : Bool #

Whether the request body is URL-encoded form data.


[View source]