Class: Rev::HttpResponseHeader

Inherits:
Hash
  • Object
show all
Defined in:
lib/rev/http_client.rb

Overview

A simple hash is returned for each request made by HttpClient with the headers that were given by the server for that request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#http_reasonObject

The reason returned in the http response (“OK”,“File not found”,etc.)



15
16
17
# File 'lib/rev/http_client.rb', line 15

def http_reason
  @http_reason
end

#http_statusObject

The status code (as a string!)



21
22
23
# File 'lib/rev/http_client.rb', line 21

def http_status
  @http_status
end

#http_versionObject

The HTTP version returned.



18
19
20
# File 'lib/rev/http_client.rb', line 18

def http_version
  @http_version
end

Instance Method Details

#chunked_encoding?Boolean

Is the transfer encoding chunked?

Returns:

  • (Boolean)


34
35
36
# File 'lib/rev/http_client.rb', line 34

def chunked_encoding?
  /chunked/i === self[HttpClient::TRANSFER_ENCODING]
end

#content_lengthObject

Length of content as an integer, or nil if chunked/unspecified



29
30
31
# File 'lib/rev/http_client.rb', line 29

def content_length
  Integer(self[HttpClient::CONTENT_LENGTH]) rescue nil
end

#statusObject

HTTP response status as an integer



24
25
26
# File 'lib/rev/http_client.rb', line 24

def status
  Integer(http_status) rescue nil
end