slightly simplify content-type check: just make sure XML is there

This commit is contained in:
Wouter Groeneveld 2022-04-20 14:55:55 +02:00
parent f57a53e1b1
commit 9d08d35576
2 changed files with 3 additions and 16 deletions

3
.gitignore vendored
View File

@ -16,4 +16,5 @@ go-jamming
vangen
*.sublime-workspace
.idea/*
.idea/*
__debug*

View File

@ -26,24 +26,10 @@ var (
"feed",
"feed/index.xml",
}
possibleContentTypes = []string{
"application/rss+xml",
"application/atom+xml",
"application/xml",
"text/xml",
"application/rdf+xml",
}
)
func isContentTypeFeedCompatible(header http.Header) bool {
cType := header.Get("Content-Type")
for _, possibleType := range possibleContentTypes {
if strings.Contains(cType, possibleType) {
return true
}
}
return false
return strings.Contains(header.Get("Content-Type"), "xml")
}
func (sndr *Sender) discoverRssFeed(domain string) (string, error) {