fix: remove extra slash from host

This commit is contained in:
Lakhan Samani 2022-11-24 12:58:04 +05:30
parent 70bab70ead
commit e985e096bc

View File

@ -20,12 +20,12 @@ func GetHost(c *gin.Context) string {
authorizerURL = "" authorizerURL = ""
} }
if authorizerURL != "" { if authorizerURL != "" {
return authorizerURL return strings.TrimSuffix(authorizerURL, "/")
} }
authorizerURL = c.Request.Header.Get("X-Authorizer-URL") authorizerURL = c.Request.Header.Get("X-Authorizer-URL")
if authorizerURL != "" { if authorizerURL != "" {
return authorizerURL return strings.TrimSuffix(authorizerURL, "/")
} }
scheme := c.Request.Header.Get("X-Forwarded-Proto") scheme := c.Request.Header.Get("X-Forwarded-Proto")
@ -33,7 +33,7 @@ func GetHost(c *gin.Context) string {
scheme = "http" scheme = "http"
} }
host := c.Request.Host host := c.Request.Host
return scheme + "://" + host return strings.TrimSuffix(scheme+"://"+host, "/")
} }
// GetHostName function returns hostname and port // GetHostName function returns hostname and port