I'm using EEx template engine to render HTML pages (no Phoenix here). I'm passing the connection (Plug.Conn
) conn
to the template along with extracted parameter list (params
) and the session map (session
) with : body = EEx.eval_file(path, conn: conn, params: conn.params, session: session)
. params
and session
are provided just for convenience as they also are in the connection.
If the page modifies the session (configured with cookies), say with something like <% Plug.Conn.put_session(conn, "reply", 42) %>
), this modifies the connection but this also remains local to the page and is not propagated.
Is there a way to retrieve this modified version of the connection from the EEx engine ?
NB: I'm talking about the connection (Plug.Conn
), but it could be any variable that is modified or created by the template engine, just a similar way Code.eval_string("a=1\n b=2\n c=a+b")
does : {3, [a: 1, b: 2, c: 3]}
.