Hi there!
I have a working controller action returning a CSV file in chunks (being streamed from the DB). I’m having trouble testing it because I only get the first chunk of the CSV (in my case the CSV headers) when I do get(conn, path)
:
test "downloads the csv with the expected rows", %{conn: conn} do
{:ok, _check} = Domain.create_check(attrs)
today = Date.utc_today()
|> Date.to_iso8601()
conn = get(conn, check_path(conn, :details, %{"start_date" => today, "end_date" => today}))
data = response(conn, 200)
end
I’ve read the documentation about the Conn.Test
, Plug.Conn.Test
but I’m still unable to overcome this. How do you test streamed file downloads in Phoenix?
Thanks in advance!