 
   get "/new" do
     conn
-    |> put_resp_content_type("text/html")
-    |> send_resp(200, Templates.new(%{}))
+    |> html_resp(200, Templates.new(%{}))
   end
 
   post "/flags" do

    case Utils.create_flag_with_name(name) do
      {:error, reason} ->
        conn
        |> put_resp_content_type("text/html")
        |> send_resp(400, Templates.new(%{error_message: reason}))
      {:ok, _} ->
        redirect_to conn, "/flags/#{name}"
    end

    body = Templates.details(flag: flag)
    
    conn
    |> html_resp(200, body)
  end


  match _ do
    send_resp(conn, 404, "")
  end


  defp html_resp(conn, status, body) do
    conn
    |> put_resp_content_type("text/html")
    |> send_resp(status, body)
  end


