Use strings.Contains instead of IndexOf for readability

This commit is contained in:
Matthew Holt 2016-09-24 12:09:28 -06:00
parent bac54de9eb
commit a4d70262aa
No known key found for this signature in database
GPG key ID: 0D97CC73664F4D03

View file

@ -111,7 +111,7 @@ func canLogRequest(r *http.Request) bool {
if r.Method == "POST" || r.Method == "PUT" {
for _, cType := range r.Header[headerContentType] {
// the cType could have charset and other info
if strings.Index(cType, contentTypeJSON) > -1 || strings.Index(cType, contentTypeXML) > -1 {
if strings.Contains(cType, contentTypeJSON) || strings.Contains(cType, contentTypeXML) {
return true
}
}