Sha256: 24162f714ce868e49f2caea15494eed8147d423d7dfbc8a8e0e69db4329bd802

Contents?: true

Size: 683 Bytes

Versions: 18

Compression:

Stored size: 683 Bytes

Contents

module Grape
  module ContentTypes
    # Content types are listed in order of preference.
    CONTENT_TYPES = { # rubocop:disable Style/MutableConstant
      xml: 'application/xml',
      serializable_hash: 'application/json',
      json: 'application/json',
      binary: 'application/octet-stream',
      txt: 'text/plain'
    }

    def self.content_types_for_settings(settings)
      return if settings.blank?

      settings.each_with_object({}) { |value, result| result.merge!(value) }
    end

    def self.content_types_for(from_settings)
      if from_settings.present?
        from_settings
      else
        Grape::ContentTypes::CONTENT_TYPES
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.2.5/lib/grape/util/content_types.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/grape-1.2.5/lib/grape/util/content_types.rb
grape-1.2.5 lib/grape/util/content_types.rb
grape-1.2.4 lib/grape/util/content_types.rb
grape-1.2.3 lib/grape/util/content_types.rb
grape-1.2.2 lib/grape/util/content_types.rb
grape-1.2.1 lib/grape/util/content_types.rb
grape-1.2.0 lib/grape/util/content_types.rb
grape-1.1.0 lib/grape/util/content_types.rb
grape-1.0.3 lib/grape/util/content_types.rb
grape-1.0.2 lib/grape/util/content_types.rb
grape-1.0.1 lib/grape/util/content_types.rb
grape-1.0.0 lib/grape/util/content_types.rb
grape-0.19.2 lib/grape/util/content_types.rb
grape-0.19.1 lib/grape/util/content_types.rb
grape-0.19.0 lib/grape/util/content_types.rb
grape-0.18.0 lib/grape/util/content_types.rb
grape-0.17.0 lib/grape/util/content_types.rb