   def render_view(conn, view_mod, layout_mod, template, assigns \\ []) do
     assigns      = Dict.merge(conn.assigns, assigns)
     content_type = response_content_type(conn)
-    extension    = Mime.ext_from_type(content_type) || ""
+    extensions   = Mime.ext_from_type(content_type)
     layout       = Dict.get(assigns, :layout, "application")
-    assigns      = Dict.put_new(assigns, :within, {layout_mod, layout <> extension})
+    assigns      = Dict.put_new(assigns, :within, {layout_mod, template_name(layout, extensions)})
     status       = Dict.get(assigns, :status, 200)
 
-    {:safe, rendered_content} = view_mod.render(template <> extension, assigns)
+    {:safe, rendered_content} = view_mod.render(template_name(template, extensions), assigns)
 
     send_response(conn, status, content_type, rendered_content)
   end
+  defp template_name(template, extensions)
+  defp template_name(template, []), do: template
+  defp template_name(template, [ext | _]), do: "#{template}.#{ext}"
 
   @doc """
   Returns the List of String Accept headers, in order of priority

    |> Enum.reverse
    |> Module.concat
  end

end

  3. "text/html" default fallback
  """
  def response_content_type(conn) do
    conn.params["format"]
    |> mime_type_from_ext
    |> Kernel.||(primary_accept_format(accept_formats(conn)))
    |> Kernel.||(@default_content_type)
  end
  defp mime_type_from_ext(extension) do
    case Mime.type_from_ext(extension) do
      @plug_default_mime_type -> nil
      x -> x
    end
  end
  defp primary_accept_format(["*/*" | _rest]), do: @default_content_type
  defp primary_accept_format([type | _rest]), do: Mime.valid_type?(type) && type
