Module: Readme::ContentTypeHelper

Included in:
HttpRequest, HttpResponse
Defined in:
lib/readme/content_type_helper.rb

Constant Summary collapse

JSON_MIME_TYPES =

Assumes the includer has a ‘content_type` method defined.

[
  'application/json',
  'application/x-json',
  'text/json',
  'text/x-json',
  '+json'
].freeze

Instance Method Summary collapse

Instance Method Details

#json?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/readme/content_type_helper.rb', line 13

def json?
  JSON_MIME_TYPES.any? { |mime_type| content_type.include?(mime_type) }
end