We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 52117da + 258944b commit dd4eb1fCopy full SHA for dd4eb1f
url.go
@@ -5,12 +5,13 @@ import (
5
"fmt"
6
"io"
7
"net/http"
8
- "strings"
+ "regexp"
9
"time"
10
)
11
12
func validURL(url string) bool {
13
- return strings.HasPrefix(url, "https://") || strings.HasPrefix(url, "http://")
+ r := regexp.MustCompile("(?i)^http(?:s)?://")
14
+ return r.MatchString(url)
15
}
16
17
func getURL(url string) (io.Reader, error) {
url_test.go
@@ -11,6 +11,7 @@ func TestValidURL(t *testing.T) {
}{
{"http://test.com", true},
{"https://test.com", true},
+ {"HttPs://test.com", true},
{"/test/test.com", false},
{"", false},
0 commit comments