Class Mosquito::MockRequest
In: lib/mosquito.rb
Parent: Object

Mock request is used for composing the request body and headers

Methods

Constants

DEFAULT_HEADERS = { 'SERVER_NAME' => 'test.host', 'PATH_INFO' => '', 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060214 Camino/1.0', 'SCRIPT_NAME' => '/', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'HTTP_CACHE_CONTROL' => 'max-age=0', 'HTTP_ACCEPT_LANGUAGE' => 'en,ja;q=0.9,fr;q=0.9,de;q=0.8,es;q=0.7,it;q=0.7,nl;q=0.6,sv;q=0.5,nb;q=0.5,da;q=0.4,fi;q=0.3,pt;q=0.3,zh-Hans;q=0.2,zh-Hant;q=0.1,ko;q=0.1', 'HTTP_HOST' => 'test.host', 'REMOTE_ADDR' => '127.0.0.1', 'SERVER_SOFTWARE' => 'Mongrel 0.3.12.4', 'HTTP_KEEP_ALIVE' => '300', 'HTTP_REFERER' => 'http://localhost/', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_VERSION' => 'HTTP/1.1', 'REQUEST_URI' => '/', 'SERVER_PORT' => '80', 'GATEWAY_INTERFACE' => 'CGI/1.2', 'HTTP_ACCEPT' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_CONNECTION' => 'keep-alive', 'REQUEST_METHOD' => 'GET', }

Attributes

body  [RW]  Should be a StringIO. However, you got some assignment methods that will stuff it with encoded parameters for you
headers  [R] 

Public Class methods

Public Instance methods

Gets a header

Sets a header

Append a freeform segment to the query string in the request. Useful when you want to quickly combine the query strings.

Retrieve the domain (analogous to HTTP_HOST)

Set the domain (changes both HTTP_HOST and SERVER_NAME)

Generates a random 22-character MIME boundary (useful for composing multipart POSTs)

Allow getters like this:

 o.REQUEST_METHOD or o.request_method

Assign a hash of parameters that should be used for POST. These might include objects that act like a file upload (with original_filename and all)

Retrieve a composed query string (including the eventual "?") with URL-escaped segments

Set a composed query string, should have URL-escaped segments and include the elements after the "?"

Assign a hash of parameters that should be used for the query string

set(key, value)

Alias for #[]=

Return an array of Camping arguments

Returns the hash of headers

Return a hash that can be used as a Rack request

[Validate]