Skip to content

Commit bc7ce68

Browse files
authored
Update elixir_auth_google.ex
Soo if the server starts using port 4001... its will only use the Scheme and Port cause most of the time the server its not being acessed with an port in the URL.
1 parent bea6f33 commit bc7ce68

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/elixir_auth_google.ex

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ defmodule ElixirAuthGoogle do
2525
@doc """
2626
`get_baseurl_from_conn/1` derives the base URL from the conn struct
2727
"""
28-
@spec get_baseurl_from_conn(conn) :: String.t()
29-
def get_baseurl_from_conn(%{host: h, port: p, scheme: s}) when p != 80 || p !=443 do
30-
"#{Atom.to_string(s)}://#{h}:#{p}"
28+
@spec get_baseurl_from_conn(conn) :: String.t()
29+
def get_baseurl_from_conn(%{host: h, port: p, scheme: s}) do
30+
if p != 80 do
31+
"#{Atom.to_string(s)}://#{h}"
32+
else
33+
"#{Atom.to_string(s)}://#{h}:#{p}"
34+
end
3135
end
3236

37+
3338
def get_baseurl_from_conn(%{host: h, scheme: s}) do
3439
"#{Atom.to_string(s)}://#{h}"
3540
end

0 commit comments

Comments
 (0)