Class: Net::Response

Inherits:
Object show all
Defined in:
flow/net/response.rb

Instance Method Summary (collapse)

Instance Method Details

- (String) body

Returns body of the response

Examples:

response.body
#=> "Hello World"

Returns:

  • (String)


45
46
47
# File 'flow/net/response.rb', line 45

def body
  options.fetch(:body, "")
end

- (Hash) headers

Returns a hash containing key/value pairs of headers

Examples:

response.headers
#=> { 'Content-Type' => 'application/josn' }

Returns:

  • (Hash)


54
55
56
# File 'flow/net/response.rb', line 54

def headers
  @headers
end

- (String) mime_type

Returns the mime type of the response

Examples:

repsonse.status_message
#=> "OK"

Returns:

  • (String)


36
37
38
# File 'flow/net/response.rb', line 36

def mime_type
  options[:mime_type]
end

- (Fixnum) status

Returns the HTTP status code of the response

Examples:

response.status_code
#=> 200

Returns:

  • (Fixnum)


18
19
20
# File 'flow/net/response.rb', line 18

def status
  options[:status_code]
end

- (String) status_message

Returns the HTTP status message of the response according to RFC 2616

Examples:

response.status_message
#=> "OK"

Returns:

  • (String)


27
28
29
# File 'flow/net/response.rb', line 27

def status_message
  options[:status_message]
end