Header module.
Provides access to @header in the mixed-into class as a hash-like object, except with case-insensitive keys. Also provides methods for accessing commonly-used header values in a more convenient format.
| Public Methods | |
|---|---|
| [] | Returns the header field corresponding to the case-insensitive key. For example, a key of "Content-Type" might return "text/html" |
| []= | Sets the header field corresponding to the case-insensitive key. |
| add_ |
[Ruby 1.8.3] Adds header field instead of replace. Second argument val must be a String. See also #[]=, #[] and #get_fields. |
| basic_ |
Set the Authorization: header for "Basic" authorization. |
| canonical_ |
Alias for #each_capitalized |
| chunked? | Returns "true" if the "transfer-encoding" header is present and set to "chunked". This is an HTTP/1.1 feature, allowing the the content to be sent in "chunks" without at the outset stating the entire content length. |
| content_ |
Returns an Integer object which represents the Content-Length: header field or nil if that field is not provided. |
| content_ |
|
| content_ |
Returns a Range object which represents Content-Range: header field. This indicates, for a partial entity body, where this fragment fits inside the full entity body, as range of byte offsets. |
| content_ |
Returns a content type string such as "text/html". This method returns nil if Content-Type: header field does not exist. |
| content_ |
Alias for #set_content_type |
| delete | Removes a header field. |
| each | Alias for #each_header |
| each_ |
As for #each_header, except the keys are provided in capitalized form. |
| each_ |
Iterates for each capitalized header names. |
| each_ |
Iterates for each header names and values. |
| each_ |
Alias for #each_name |
| each_ |
Iterates for each header names. |
| each_ |
Iterates for each header values. |
| fetch | Returns the header field corresponding to the case-insensitive key. Returns the default value args, or the result of the block, or nil, if there’s no header field named key. See Hash#fetch |
| form_ |
Alias for #set_form_data |
| get_ |
[Ruby 1.8.3] Returns an array of header field strings corresponding to the case-insensitive key. This method allows you to get duplicated header fields without any processing. See also #[]. |
| initialize_ |
|
| key? | true if key header exists. |
| length | Alias for #size |
| main_ |
Returns a content type string such as "text". This method returns nil if Content-Type: header field does not exist. |
| proxy_ |
Set Proxy-Authorization: header for "Basic" authorization. |
| range | Returns an Array of Range objects which represents Range: header field, or nil if there is no such header. |
| range= | Alias for #set_range |
| range_ |
The length of the range represented in Content-Range: header. |
| set_ |
Set Content-Type: header field by type and params. type must be a String, params must be a Hash. |
| set_ |
Set header fields and a body from HTML form data. params should be a Hash containing HTML form data. Optional argument sep means data record separator. |
| set_ |
Set Range: header from Range (arg r) or beginning index and length from it (arg idx&len). |
| size | |
| sub_ |
Returns a content type string such as "html". This method returns nil if Content-Type: header field does not exist or sub-type is not given (e.g. "Content-Type: text"). |
| to_ |
Returns a Hash consist of header names and values. |
| type_ |
Returns content type parameters as a Hash as like {"charset" => "iso-2022-jp"}. |
| Private Methods | |
|---|---|
| basic_ |
|
| capitalize | |
| urlencode | |
<code/>and<pre/>for code samples.