Sha256: 6b6107eb352d62496c2d9ad249952c6ec0f8aa25b41a10d9803ae4fb74767e67

Contents?: true

Size: 635 Bytes

Versions: 22

Compression:

Stored size: 635 Bytes

Contents

module Rack
  module Accept
    module Header
      class << self
        # Corrected version of https://github.com/mjackson/rack-accept/blob/master/lib/rack/accept/header.rb#L40-L44
        def parse_media_type(media_type)
          # see http://tools.ietf.org/html/rfc6838#section-4.2 for allowed characters in media type names
          m = media_type.to_s.match(%r{^([a-z*]+)\/([a-z0-9*\&\^\-_#\$!.+]+)(?:;([a-z0-9=;]+))?$})
          m ? [m[1], m[2], m[3] || ''] : []
        end
      end
    end

    class MediaType
      def parse_media_type(media_type)
        Header.parse_media_type(media_type)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

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