Module: Atom::HTTPResponse

Defined in:
lib/atom/http.rb

Instance Method Summary collapse

Instance Method Details

#validate_content_type(valid) ⇒ Object

this should probably support ranges (eg. text/*)



323
324
325
326
327
328
329
330
331
# File 'lib/atom/http.rb', line 323

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