Query_params not accessible in controller_test

I am trying to create a test wherein after a post method I will redirect the user with query params associated with it

# controller.ex
def function(conn, params) do
 ...
 conn
 |> redirect(to: <path + id: id, name: name> ) 
end

# controller_test.exs
conn = post(conn, Routes.path(conn, :function), params)

# %{id: id, name: name} = redirected_params(conn) -> error
# %{id: id, name: name} = conn.query_params -> error

but when I look at the returned connection from the test, it seems that the query_params and query_strings are empty.

what is the way to get the query_params/query_strings generated from the controller to controller_test?

|> redirect doesn’t set query params, it sets the Location header and sets the HTTP status code to 302 (redirect). Check the response headers for the Location header, it should contain the URL you’re redirecting the user to.

Thank you @benwilson512.