rename getURL() to resolveURL() because "get" may imply actually GETting it
This commit is contained in:
1 parent
b398e2ddf4
commit
65b119ace6
2 files changed
+4
-4
No files matched your search
@@ -26,9 +26,9 @@ func checkURL(u *url.URL) error {
|
|||||||
return nil // success!
|
return nil // success!
|
||||||
}
|
}
|
||||||
|
|
||||||
// getURL takes a URL and its referring URL and tries to parse it into an acceptable complete URL
|
// resolveURL takes a URL and its referring URL and tries to parse it into an acceptable complete URL
|
||||||
// returns the final URL and any error
|
// returns the final URL and any error
|
||||||
func getURL(referringURL string, currentURL string) (*url.URL, error) {
|
func resolveURL(referringURL string, currentURL string) (*url.URL, error) {
|
||||||
// begin by parsing both URLs
|
// begin by parsing both URLs
|
||||||
uCurrent, err := url.Parse(currentURL)
|
uCurrent, err := url.Parse(currentURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ func TestBadURL(t *testing.T) {
|
|||||||
|
|
||||||
// some tests for the base url resolution (absolute vs. relative links)
|
// some tests for the base url resolution (absolute vs. relative links)
|
||||||
func doResolveTest(t *testing.T, wanted, referrer, current string) {
|
func doResolveTest(t *testing.T, wanted, referrer, current string) {
|
||||||
u, err := getURL(referrer, current)
|
u, err := resolveURL(referrer, current)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("getURL failed (probably parsing)")
|
t.Error("resolveURL failed (probably parsing)")
|
||||||
}
|
}
|
||||||
if u.String() != wanted {
|
if u.String() != wanted {
|
||||||
fmt.Printf(" Got: %q\n", u)
|
fmt.Printf(" Got: %q\n", u)
|
||||||
|
|||||||
Reference in new issue
Block a user