class SF::Http::Response
inherits Reference
#
Define a HTTP response
Constructors#
Methods#
#body : String
#
Get the body of the response
The body of a response may contain:
- the requested page (for GET requests)
- a response from the server (for POST requests)
- nothing (for HEAD requests)
- an error message (in case of an error)
Returns: The response body
#dup : Response
#
Returns a shallow copy of this object.
This allocates a new object and copies the contents of
self
into it.
#get_field(field : String) : String
#
Get the value of a field
If the field field is not found in the response header, the empty string is returned. This function uses case-insensitive comparisons.
- field - Name of the field to get
Returns: Value of the field, or empty string if not found
#major_http_version : Int32
#
Get the major HTTP version number of the response
Returns: Major HTTP version number
See also: minor_http_version
#minor_http_version : Int32
#
Get the minor HTTP version number of the response
Returns: Minor HTTP version number
See also: major_http_version
#status : Http::Response::Status
#
Get the response status code
The status code should be the first thing to be checked after receiving a response, it defines whether it is a success, a failure or anything else (see the Status enumeration).
Returns: Status code of the response