class SF::Http::Response
- SF::Http::Response
- Reference
- Object
Overview
Define a HTTP response
Defined in:
network/obj.crConstructors
-
.new
Default constructor
Instance Method Summary
-
#body : String
Get the body of the response
-
#dup : Response
Returns a shallow copy of this object.
- #finalize
-
#get_field(field : String) : String
Get the value of a field
-
#major_http_version : Int32
Get the major HTTP version number of the response
-
#minor_http_version : Int32
Get the minor HTTP version number of the response
-
#status : Http::Response::Status
Get the response status code
Constructor Detail
Instance Method Detail
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
Returns a shallow copy of this object.
This allocates a new object and copies the contents of
self
into it.
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
Get the major HTTP version number of the response
Returns: Major HTTP version number
See also: #minor_http_version
Get the minor HTTP version number of the response
Returns: Minor HTTP version number
See also: #major_http_version
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