Create and use isValidURL
This commit is contained in:
6
atom.go
6
atom.go
@@ -2,6 +2,7 @@ package atomfeed
|
||||
|
||||
import (
|
||||
"mime"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -12,6 +13,11 @@ type (
|
||||
URI string
|
||||
)
|
||||
|
||||
func isValidURL(testURL URI) bool {
|
||||
_, err := url.ParseRequestURI(string(testURL))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func isCompositeMediaType(mediaType string) bool {
|
||||
mediaType, _, err := mime.ParseMediaType(mediaType)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user