fix: bug with authorizer url
This commit is contained in:
@@ -34,3 +34,16 @@ func SaveSessionInDB(userId string, c *gin.Context) {
|
||||
log.Println("=> session saved in db:", sessionData)
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveDuplicateString removes duplicate strings from a string slice
|
||||
func RemoveDuplicateString(strSlice []string) []string {
|
||||
allKeys := make(map[string]bool)
|
||||
list := []string{}
|
||||
for _, item := range strSlice {
|
||||
if _, value := allKeys[item]; !value {
|
||||
allKeys[item] = true
|
||||
list = append(list, item)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
@@ -1,10 +1,23 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GetHost returns hostname from request context
|
||||
func GetHost(c *gin.Context) string {
|
||||
scheme := "http"
|
||||
if c.Request.TLS != nil {
|
||||
scheme = "https"
|
||||
}
|
||||
log.Println("=> url:", scheme+"://"+c.Request.Host)
|
||||
return scheme + "://" + c.Request.Host
|
||||
}
|
||||
|
||||
// GetHostName function returns hostname and port
|
||||
func GetHostParts(uri string) (string, string) {
|
||||
tempURI := uri
|
||||
|
Reference in New Issue
Block a user