-
-
Save motephyr/f5c5a81ef286fb7e18946e073a8b3686 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule BidhouseWeb.Router do | |
use BidhouseWeb, :router | |
use Coherence.Router # Add this | |
use ExAdmin.Router | |
pipeline :browser do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_flash | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers | |
plug Coherence.Authentication.Session # Add this | |
plug NavigationHistory.Tracker, excluded_paths: ["/login", "/sessions", "/auth"] | |
plug :trim_tag | |
end | |
def trim_tag(conn, _opts) do | |
Plug.Conn.register_before_send(conn, fn(conn) -> | |
case get_resp_header(conn, "content-type") do | |
[content_type | _tail] -> | |
if String.contains?(content_type, "text/html") do | |
resp(conn, conn.status, conn.resp_body |> to_string |> String.replace( ~r/>\s+/, ">") ) | |
else | |
conn | |
end | |
_ -> conn | |
end | |
end) | |
end | |
#... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment