module Grape::ContentTypes

Constants

DEFAULTS

Content types are listed in order of preference.

MIME_TYPES

Public Instance Methods

content_types_for(from_settings) click to toggle source
# File lib/grape/content_types.rb, line 18
def content_types_for(from_settings)
  from_settings.presence || DEFAULTS
end
mime_types_for(from_settings) click to toggle source
# File lib/grape/content_types.rb, line 22
def mime_types_for(from_settings)
  return MIME_TYPES if from_settings == Grape::ContentTypes::DEFAULTS

  from_settings.each_with_object({}) do |(k, v), types_without_params|
    # remove optional parameter
    types_without_params[v.split(';', 2).first] = k
  end
end