Skip to content

Instantly share code, notes, and snippets.

@lukasender
Created November 24, 2017 07:13
Show Gist options
  • Save lukasender/3714ce850bee0ebef04f11cf77c1f7a9 to your computer and use it in GitHub Desktop.
Save lukasender/3714ce850bee0ebef04f11cf77c1f7a9 to your computer and use it in GitHub Desktop.
# Router example:
get "/", Redirector, external: "http://other-domain/"
# Test case:
test "route redirected to external route without path/query" do
conn = call(Router, :get, "/")
assert_redirected_to(conn, "http://other-domain/")
end
# Additional code in "redirector.ex" which handles this case:
defp merge_query_string(%URI{query: nil} = destination_uri, %Plug.Conn{query_string: ""}) do
destination_uri
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment