lib/roda/plugins/type_routing.rb
# The response type indicated by the Accept request header.
The response type indicated by the Accept request header.
The response type indicated by the Accept request header .
def accept_response_type
          mimes = @scope.opts[:type_routing][:mimes]
          @env['HTTP_ACCEPT'].to_s.split(/\s*,\s*/).map do |part|
            mime, _= part.split(/\s*;\s*/, 2)
            if sym = mimes[mime]
              response['Vary'] = (vary = response['Vary']) ? "#{vary}, Accept" : 'Accept'
              return sym
            end
          end
          nil
        end
def accept_response_type mimes = @scope . opts [ :type_routing ] [ :mimes ] @env [ 'HTTP_ACCEPT' ] . to_s . split ( / \s *, \s * / ) . map do | part | mime , _ = part . split ( / \s *; \s * / , 2 ) if sym = mimes [ mime ] response [ 'Vary' ] = ( vary = response [ 'Vary' ] ) ? "#{vary}, Accept" : 'Accept' return sym end end nil end
The response type indicated by the Accept request header.
The response type indicated by the Accept request header .