I got a simple Plug post handler like this
post "/some/url" do
# do something
# render(something)
end
…but I would like to redirect somehow to another get
handler, instead of rendering html.
How to do this using plug_cowboy 2.0?
There is no magic: you have to send HTTP 302
response:
conn
|> put_resp_header("location", url)
|> send_resp(conn.status || 302, "text/html", body)
Phoenix does the same.