Class | Rack::Request |
In: |
lib/rack/auth/openid.rb
lib/rack/request.rb |
Parent: | Object |
Rack::Request provides a convenient interface to a Rack environment. It is stateless, the environment env passed to the constructor will be directly modified.
req = Rack::Request.new(env) req.post? req.params["data"]
The environment hash passed will store a reference to the Request object instantiated so that it will only instantiate if an instance of the Request object doesn‘t already exist.
FORM_DATA_MEDIA_TYPES | = | [ nil, 'application/x-www-form-urlencoded', 'multipart/form-data' | The set of form-data media-types. Requests that do not indicate one of the media types presents in this list will not be eligible for form-data / param parsing. | |
PARSEABLE_DATA_MEDIA_TYPES | = | [ 'multipart/related', 'multipart/mixed' | The set of media-types. Requests that do not indicate one of the media types presents in this list will not be eligible for param parsing like soap attachments or generic multiparts |
env | [R] | The environment of the request. |
Returns the data recieved in the request body.
This method support both application/x-www-form-urlencoded and multipart/form-data.
The character set of the request body if a "charset" media type parameter was given, or nil if no "charset" was specified. Note that, per RFC2616, text/* media types that specify no explicit charset are to be considered ISO-8859-1.
Determine whether the request body contains form-data by checking the request media_type against registered form-data media-types: "application/x-www-form-urlencoded" and "multipart/form-data". The list of form-data media types can be modified through the FORM_DATA_MEDIA_TYPES array.
The media type (type/subtype) portion of the CONTENT_TYPE header without any media type parameters. e.g., when CONTENT_TYPE is "text/plain;charset=utf-8", the media-type is "text/plain".
For more information on the use of media types in HTTP, see: www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
The media type parameters provided in CONTENT_TYPE as a Hash, or an empty Hash if no CONTENT_TYPE or media-type parameters were provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8", this method responds with the following Hash:
{ 'charset' => 'utf-8' }
Determine whether the request body contains data by checking the request media_type against registered parse-data media-types