This repository has been archived on 2022-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
dex/pkg/net/url.go
2015-08-18 11:26:57 -07:00

20 lines
373 B
Go

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)
}