dex/pkg/net/url.go

21 lines
373 B
Go
Raw Normal View History

2015-08-18 05:57:27 +05:30
package net
import (
"net/url"
"strings"
)
// URLEqual checks two urls for equality using only the host and path portions.
func URLEqual(url1, url2 string) bool {
u1, err := url.Parse(url1)
if err != nil {
return false
}
u2, err := url.Parse(url2)
if err != nil {
return false
}
return strings.ToLower(u1.Host+u1.Path) == strings.ToLower(u2.Host+u2.Path)
}