module ActionDispatch::Http::MimeNegotiation

def format_from_path_extension

def format_from_path_extension
  path = get_header("action_dispatch.original_path") || get_header("PATH_INFO")
  if match = path && path.match(/\.(\w+)\z/)
    Mime[match.captures.first]
  end
end