Module: Atom::HTTPResponse
- Defined in:
- lib/atom/http.rb
Constant Summary collapse
- HOP_BY_HOP =
['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
Instance Method Summary collapse
- #end2end_headers ⇒ Object
-
#validate_content_type(valid) ⇒ Object
this should probably support ranges (eg. text/*).
Instance Method Details
#end2end_headers ⇒ Object
496 497 498 499 500 501 502 |
# File 'lib/atom/http.rb', line 496 def end2end_headers hopbyhop = HOP_BY_HOP if self['connection'] hopbyhop += self['connection'].split(',').map { |x| x.strip } end @header.keys.reject { |x| hopbyhop.member? x.downcase } end |
#validate_content_type(valid) ⇒ Object
this should probably support ranges (eg. text/*)
486 487 488 489 490 491 492 493 494 |
# File 'lib/atom/http.rb', line 486 def validate_content_type( valid ) raise Atom::HTTPException, "HTTP response contains no Content-Type!" if not self.content_type or self.content_type.empty? media_type = self.content_type.split(";").first unless valid.member? media_type.downcase raise Atom::WrongMimetype, "unexpected response Content-Type: #{media_type.inspect}. should be one of: #{valid.inspect}" end end |