Move the parsing of the media type to isXMLMediaType
This commit is contained in:
10
atom.go
10
atom.go
@@ -1,6 +1,9 @@
|
||||
package atomfeed
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"mime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type (
|
||||
EmailAddress string
|
||||
@@ -10,5 +13,10 @@ type (
|
||||
)
|
||||
|
||||
func isXMLMediaType(mediaType string) bool {
|
||||
mediaType, _, err := mime.ParseMediaType(mediaType)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return strings.HasSuffix(mediaType, "/xml") || strings.HasSuffix(mediaType, "+xml")
|
||||
}
|
||||
|
Reference in New Issue
Block a user