class

SF::Http::Response

Inherits Reference / Object

Define a HTTP response

Constructors

new

Default constructor

Constructs an empty response.

Source

Instance methods

body

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

Source
dup

Returns a shallow copy of this object.

This allocates a new object and copies the contents of self into it.

Source
finalize
Source
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

Source
major_http_version

Get the major HTTP version number of the response

Returns: Major HTTP version number

See also: minor_http_version

Source
minor_http_version

Get the minor HTTP version number of the response

Returns: Minor HTTP version number

See also: major_http_version

Source
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

Source

Nested types