When I have a browser pipeline configured;
pipeline :browser do
plug :accepts, ~w(js html)
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
And a controller like the following;
def form(conn, _params) do
# Always receiving "html" here
IO.inspect get_format(conn)
conn
|> put_layout_formats(["html"])
|> render(:form)
end
I expected that with a request accept header like text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
, to render form.js.eex
. But unfortunately it always renders form.html.eex
.