diff --git a/qurl/qurl.go b/qurl/qurl.go index fd1812d..fa4e3b7 100644 --- a/qurl/qurl.go +++ b/qurl/qurl.go @@ -29,6 +29,14 @@ func (q *QURL) CheckValid() error { return err } + if u.Scheme == "" { + return fmt.Errorf("URLs must begin with a scheme (e.g. https:)") + } + + if u.Host == "" && u.RawQuery == "" && u.RawPath == "" && u.Fragment == "" { + return fmt.Errorf("URLs must contain a path, host, query or fragment element") + } + if !u.IsAbs() { return fmt.Errorf("Relative URLs are not allowed") }