formats() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_dispatch/http/mime_negotiation.rb, line 79
      def formats
        fetch_header("action_dispatch.request.formats") do |k|
          v = if params_readable?
            Array(Mime[parameters[:format]])
          elsif use_accept_header && valid_accept_header
            accepts.dup
          elsif extension_format = format_from_path_extension
            [extension_format]
          elsif xhr?
            [Mime[:js]]
          else
            [Mime[:html]]
          end

          v.select! do |format|
            format.symbol || format.ref == "*/*"
          end

          set_header k, v
        end
      end
Register or log in to add new notes.