Class: EventMachine::HttpResponseHeader
- Defined in:
- lib/em-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
-
#http_reason ⇒ Object
The reason returned in the http response (“OK”,“File not found”,etc.).
-
#http_status ⇒ Object
The status code (as a string!).
-
#http_version ⇒ Object
The HTTP version returned.
Instance Method Summary collapse
-
#chunked_encoding? ⇒ Boolean
Is the transfer encoding chunked?.
- #compressed? ⇒ Boolean
-
#content_length ⇒ Object
Length of content as an integer, or nil if chunked/unspecified.
- #keep_alive? ⇒ Boolean
-
#status ⇒ Object
HTTP response status as an integer.
Methods inherited from Hash
Instance Attribute Details
#http_reason ⇒ Object
The reason returned in the http response (“OK”,“File not found”,etc.)
16 17 18 |
# File 'lib/em-http/client.rb', line 16 def http_reason @http_reason end |
#http_status ⇒ Object
The status code (as a string!)
22 23 24 |
# File 'lib/em-http/client.rb', line 22 def http_status @http_status end |
#http_version ⇒ Object
The HTTP version returned.
19 20 21 |
# File 'lib/em-http/client.rb', line 19 def http_version @http_version end |
Instance Method Details
#chunked_encoding? ⇒ Boolean
Is the transfer encoding chunked?
35 36 37 |
# File 'lib/em-http/client.rb', line 35 def chunked_encoding? /chunked/i === self[HttpClient::TRANSFER_ENCODING] end |
#compressed? ⇒ Boolean
43 44 45 |
# File 'lib/em-http/client.rb', line 43 def compressed? /gzip|compressed|deflate/i === self[HttpClient::CONTENT_ENCODING] end |
#content_length ⇒ Object
Length of content as an integer, or nil if chunked/unspecified
30 31 32 |
# File 'lib/em-http/client.rb', line 30 def content_length Integer(self[HttpClient::CONTENT_LENGTH]) rescue nil end |
#keep_alive? ⇒ Boolean
39 40 41 |
# File 'lib/em-http/client.rb', line 39 def keep_alive? /keep-alive/i === self[HttpClient::KEEP_ALIVE] end |
#status ⇒ Object
HTTP response status as an integer
25 26 27 |
# File 'lib/em-http/client.rb', line 25 def status Integer(http_status) rescue nil end |