Module: K8

Defined in:
lib/keight.rb

Defined Under Namespace

Modules: Mock, Util Classes: Action, ActionClassMapping, ActionFinder, ActionMethodMapping, ActionRouter, BaseAction, BaseConfig, BaseError, ConfigError, ContentTypeRequiredError, DefaultPatterns, HttpException, RackApplication, Request, Response, SecretValue, UnknownContentError, UploadedFile

Constant Summary collapse

FILEPATH =
__FILE__
HTTP_REQUEST_METHODS =
{
  "GET"     => :GET,
  "POST"    => :POST,
  "PUT"     => :PUT,
  "DELETE"  => :DELETE,
  "HEAD"    => :HEAD,
  "PATCH"   => :PATCH,
  "OPTIONS" => :OPTIONS,
  "TRACE"   => :TRACE,
}.each {|k, _| k.freeze }
HTTP_RESPONSE_STATUS =
{
  100 => "Continue",
  101 => "Switching Protocols",
  102 => "Processing",
  200 => "OK",
  201 => "Created",
  202 => "Accepted",
  203 => "Non-Authoritative Information",
  204 => "No Content",
  205 => "Reset Content",
  206 => "Partial Content",
  207 => "Multi-Status",
  208 => "Already Reported",
  226 => "IM Used",
  300 => "Multiple Choices",
  301 => "Moved Permanently",
  302 => "Found",
  303 => "See Other",
  304 => "Not Modified",
  305 => "Use Proxy",
  307 => "Temporary Redirect",
  400 => "Bad Request",
  401 => "Unauthorized",
  402 => "Payment Required",
  403 => "Forbidden",
  404 => "Not Found",
  405 => "Method Not Allowed",
  406 => "Not Acceptable",
  407 => "Proxy Authentication Required",
  408 => "Request Timeout",
  409 => "Conflict",
  410 => "Gone",
  411 => "Length Required",
  412 => "Precondition Failed",
  413 => "Request Entity Too Large",
  414 => "Request-URI Too Long",
  415 => "Unsupported Media Type",
  416 => "Requested Range Not Satisfiable",
  417 => "Expectation Failed",
  418 => "I'm a teapot",
  422 => "Unprocessable Entity",
  423 => "Locked",
  424 => "Failed Dependency",
  426 => "Upgrade Required",
  500 => "Internal Server Error",
  501 => "Not Implemented",
  502 => "Bad Gateway",
  503 => "Service Unavailable",
  504 => "Gateway Timeout",
  505 => "HTTP Version Not Supported",
  506 => "Variant Also Negotiates",
  507 => "Insufficient Storage",
  508 => "Loop Detected",
  510 => "Not Extended",
}.each {|_, v| v.freeze }
MIME_TYPES =
{
  '.html'    => 'text/html',
  '.htm'     => 'text/html',
  '.shtml'   => 'text/html',
  '.css'     => 'text/css',
  '.csv'     => 'text/comma-separated-values',
  '.tsv'     => 'text/tab-separated-values',
  '.xml'     => 'text/xml',
  '.mml'     => 'text/mathml',
  '.txt'     => 'text/plain',
  '.wml'     => 'text/vnd.wap.wml',
  '.gif'     => 'image/gif',
  '.jpeg'    => 'image/jpeg',
  '.jpg'     => 'image/jpeg',
  '.png'     => 'image/png',
  '.tif'     => 'image/tiff',
  '.tiff'    => 'image/tiff',
  '.ico'     => 'image/x-icon',
  '.bmp'     => 'image/x-ms-bmp',
  '.svg'     => 'image/svg+xml',
  '.svgz'    => 'image/svg+xml',
  '.webp'    => 'image/webp',
  '.mid'     => 'audio/midi',
  '.midi'    => 'audio/midi',
  '.kar'     => 'audio/midi',
  '.mp3'     => 'audio/mpeg',
  '.ogg'     => 'audio/ogg',
  '.m4a'     => 'audio/x-m4a',
  '.ra'      => 'audio/x-realaudio',
  '.3gpp'    => 'video/3gpp',
  '.3gp'     => 'video/3gpp',
  '.3g2'     => 'video/3gpp2',
  '.ts'      => 'video/mp2t',
  '.mp4'     => 'video/mp4',
  '.mpeg'    => 'video/mpeg',
  '.mpg'     => 'video/mpeg',
  '.mov'     => 'video/quicktime',
  '.webm'    => 'video/webm',
  '.flv'     => 'video/x-flv',
  '.m4v'     => 'video/x-m4v',
  '.mng'     => 'video/x-mng',
  '.asx'     => 'video/x-ms-asf',
  '.asf'     => 'video/x-ms-asf',
  '.wmv'     => 'video/x-ms-wmv',
  '.avi'     => 'video/x-msvideo',
  '.json'    => 'application/json',
  '.js'      => 'application/javascript',
  '.atom'    => 'application/atom+xml',
  '.rss'     => 'application/rss+xml',
  '.doc'     => 'application/msword',
  '.pdf'     => 'application/pdf',
  '.ps'      => 'application/postscript',
  '.eps'     => 'application/postscript',
  '.ai'      => 'application/postscript',
  '.rtf'     => 'application/rtf',
  '.xls'     => 'application/vnd.ms-excel',
  '.eot'     => 'application/vnd.ms-fontobject',
  '.ppt'     => 'application/vnd.ms-powerpoint',
  '.key'     => 'application/vnd.apple.keynote',
  '.pages'   => 'application/vnd.apple.pages',
  '.numbers' => 'application/vnd.apple.numbers',
  '.zip'     => 'application/zip',
  '.lha'     => 'application/x-lzh',
  '.lzh'     => 'application/x-lzh',
  '.tar'     => 'application/x-tar',
  '.tgz'     => 'application/x-tar',
  '.gz'      => 'application/x-gzip',
  '.bz2'     => 'application/x-bzip2',
  '.xz'      => 'application/x-xz',
  '.7z'      => 'application/x-7z-compressed',
  '.rar'     => 'application/x-rar-compressed',
  '.rpm'     => 'application/x-redhat-package-manager',
  '.deb'     => 'application/vnd.debian.binary-package',
  '.swf'     => 'application/x-shockwave-flash',
  '.der'     => 'application/x-x509-ca-cert',
  '.pem'     => 'application/x-x509-ca-cert',
  '.crt'     => 'application/x-x509-ca-cert',
  '.xpi'     => 'application/x-xpinstall',
  '.xhtml'   => 'application/xhtml+xml',
  '.xspf'    => 'application/xspf+xml',
  '.yaml'    => 'application/x-yaml',
  '.yml'     => 'application/x-yaml',
  '.docx'    => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  '.xlsx'    => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  '.pptx'    => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
}.each {|k, v| k.freeze; v.freeze }
REQUEST_CLASS =
Request
RESPONSE_CLASS =
Response

Class Method Summary collapse

Class Method Details

.REQUEST_CLASS=(klass) ⇒ Object



707
708
709
710
711
# File 'lib/keight.rb', line 707

def self.REQUEST_CLASS=(klass)
  #; [!7uqb4] changes default request class.
  remove_const :REQUEST_CLASS
  const_set :REQUEST_CLASS, klass
end

.RESPONSE_CLASS=(klass) ⇒ Object



713
714
715
716
717
# File 'lib/keight.rb', line 713

def self.RESPONSE_CLASS=(klass)
  #; [!c1bd0] changes default response class.
  remove_const :RESPONSE_CLASS
  const_set :RESPONSE_CLASS, klass
end