Sha256: 78026e439bc857a9bbc211623b425d143fa41c232d1dbf94e259446b34eefc55
Contents?: true
Size: 648 Bytes
Versions: 2
Compression:
Stored size: 648 Bytes
Contents
# frozen_string_literal: true module Grape module Util module Accept module Header ALLOWED_CHARACTERS = %r{^([a-z*]+)/([a-z0-9*&\^\-_#{$ERROR_INFO}.+]+)(?:;([a-z0-9=;]+))?$}.freeze 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&.match(ALLOWED_CHARACTERS) m ? [m[1], m[2], m[3] || ''] : [] end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grape-2.1.1 | lib/grape/util/accept/header.rb |
grape-2.1.0 | lib/grape/util/accept/header.rb |