module Acfs::Response::Formats
Quick accessors for format handling.
Public Instance Methods
Source
# File lib/acfs/response/formats.rb, line 9 def content_type @content_type ||= read_content_type end
Source
# File lib/acfs/response/formats.rb, line 13 def json? content_type == Mime[:json] end
Private Instance Methods
Source
# File lib/acfs/response/formats.rb, line 19 def read_content_type return 'text/plain' unless headers && headers['Content-Type'] content_type = headers['Content-Type'].split(/;\s*\w+="?\w+"?/).first Mime::Type.parse(content_type).first end