slightly simplify content-type check: just make sure XML is there
This commit is contained in:
parent
f57a53e1b1
commit
9d08d35576
|
@ -16,4 +16,5 @@ go-jamming
|
||||||
vangen
|
vangen
|
||||||
|
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
.idea/*
|
.idea/*
|
||||||
|
__debug*
|
|
@ -26,24 +26,10 @@ var (
|
||||||
"feed",
|
"feed",
|
||||||
"feed/index.xml",
|
"feed/index.xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
possibleContentTypes = []string{
|
|
||||||
"application/rss+xml",
|
|
||||||
"application/atom+xml",
|
|
||||||
"application/xml",
|
|
||||||
"text/xml",
|
|
||||||
"application/rdf+xml",
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func isContentTypeFeedCompatible(header http.Header) bool {
|
func isContentTypeFeedCompatible(header http.Header) bool {
|
||||||
cType := header.Get("Content-Type")
|
return strings.Contains(header.Get("Content-Type"), "xml")
|
||||||
for _, possibleType := range possibleContentTypes {
|
|
||||||
if strings.Contains(cType, possibleType) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sndr *Sender) discoverRssFeed(domain string) (string, error) {
|
func (sndr *Sender) discoverRssFeed(domain string) (string, error) {
|
||||||
|
|
Loading…
Reference in New Issue