Skip to content

Commit 11436d7

Browse files
authored
feat: add util to valid url (#172)
1 parent 160b6ba commit 11436d7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/util/webhunter.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,3 +529,13 @@ func execute(client *http.Client, req *http.Request) (*Result, error) {
529529

530530
return nil, http.ErrNotSupported
531531
}
532+
533+
func IsValidURL(str string) bool {
534+
_, err := uri.ParseRequestURI(str)
535+
return err == nil
536+
}
537+
538+
func IsValidFullURL(str string) bool {
539+
u, err := uri.Parse(str)
540+
return err == nil && u.Scheme != "" && u.Host != ""
541+
}

0 commit comments

Comments
 (0)