class EventMachine::HttpResponseHeader
A simple hash is returned for each request made by HttpClient
with the headers that were given by the server for that request.
Attributes
The reason returned in the http response (string - e.g. “OK”)
The status code (integer - e.g. 200)
The HTTP version returned (string - e.g. “1.1”)
Raw headers
Public Instance Methods
Source
# File lib/em-http/http_header.rb, line 59 def [](key) super(key) || super(key.upcase.gsub('-','_')) end
Calls superclass method
Source
# File lib/em-http/http_header.rb, line 43 def chunked_encoding? /chunked/i === self[HttpClient::TRANSFER_ENCODING] end
Is the transfer encoding chunked?
Source
# File lib/em-http/http_header.rb, line 75 def client_error? 400 <= status && 500 > status end
Source
# File lib/em-http/http_header.rb, line 51 def compressed? /gzip|compressed|deflate/i === self[HttpClient::CONTENT_ENCODING] end
Source
# File lib/em-http/http_header.rb, line 32 def content_length @content_length ||= ((s = self[HttpClient::CONTENT_LENGTH]) && (s =~ /^(\d+)$/)) ? $1.to_i : nil end
Length of content as an integer, or nil if chunked/unspecified
Source
# File lib/em-http/http_header.rb, line 63 def informational? 100 <= status && 200 > status end
Source
# File lib/em-http/http_header.rb, line 47 def keepalive? /keep-alive/i === self[HttpClient::KEEP_ALIVE] end
Source
# File lib/em-http/http_header.rb, line 22 def last_modified self[HttpClient::LAST_MODIFIED] end
Source
# File lib/em-http/http_header.rb, line 55 def location self[HttpClient::LOCATION] end
Source
# File lib/em-http/http_header.rb, line 71 def redirection? 300 <= status && 400 > status end
Source
# File lib/em-http/http_header.rb, line 79 def server_error? 500 <= status && 600 > status end
Source
# File lib/em-http/http_header.rb, line 27 def status Integer(http_status) rescue 0 end
HTTP response status
Source
# File lib/em-http/http_header.rb, line 67 def successful? 200 <= status && 300 > status end