Net::HTTPHeader

It is used as a mixin by other classes, to provide hash-like access to HTTP header values. Unlike raw hash access, HTTPHeader provides access via case-insensitive
keys. It also provides methods for accessing commonly-used HTTP header values in more convenient formats.

Public Instance Methods

[](key)click to toggle source

Returns the header field corresponding to the case-insensitive key. For
example, a key of “Content-Type” might return “text/html”

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.

Returns a Range object which represents the value of the Content-Range:
header field. For a partial entity body, this indicates where this fragment
fits inside the full entity body, as range of byte offsets.

Returns the header field corresponding to the case-insensitive key. Returns
the default value args, or the result of the block, or raises
an IndexError if there’s no header field named key See
Hash#fetch

Sets the content type in an HTTP header. The
type should be a full HTTP content
type, e.g. “text/html”. The params are an optional Hash of
parameters to add after the content type, e.g. {‘charset’ =>
‘iso-8859-1’}

Set a HTML form data set. params is the form data set; it is
an Array of Arrays or a Hash +enctype is the type to encode the form data
set. It is application/x-www-form-urlencoded or multipart/form-data.
formpot is an optional hash to specify the detail.

boundary

the boundary of the multipart message

charset

the charset of the message. All names and the values of non-file fields are
encoded as the charset.

Each item of params is an array and contains following items:

name

the name of the field

value

the value of the field, it should be a String or a File

opt

an optional hash to specify additional information

Each item is a file field or a normal field. If value is a
File object or the opt have a filename key, the item is
treated as a file field.

If Transfer-Encoding is set as chunked, this send the request in chunked
encoding. Because chunked encoding is HTTP/1.1 feature, you must confirm
the server to support HTTP/1.1 before sending it.