MCPcopy Create free account
hub / github.com/apache/answer / IsURL

Function IsURL

pkg/checker/url.go:27–43  ·  view source on GitHub ↗
(str string)

Source from the content-addressed store, hash-verified

25)
26
27func IsURL(str string) bool {
28 s := strings.ToLower(str)
29
30 if len(s) == 0 {
31 return false
32 }
33
34 u, err := url.Parse(s)
35 if err != nil || u.Scheme == "" {
36 return false
37 }
38
39 if u.Host == "" && u.Fragment == "" && u.Opaque == "" {
40 return false
41 }
42 return u.Scheme == "http" || u.Scheme == "https"
43}

Callers 4

CloseQuestionMethod · 0.92
selectedAvatarMethod · 0.92
AddReportMethod · 0.92
CheckMethod · 0.92

Calls 1

ParseMethod · 0.80

Tested by

no test coverage detected