mirror of
https://gitee.com/samwaf/SamWaf.git
synced 2026-10-31 18:21:51 +08:00
30 lines
768 B
Go
30 lines
768 B
Go
package utils
|
|
|
|
import "strings"
|
|
|
|
// IsContent 是否是内容
|
|
func IsContent(contentType string) bool {
|
|
var allowedSortFields = []string{"application/json", "text/xml", "application/xml",
|
|
"text/plain", "text/html", "text/csv", "application/html"}
|
|
|
|
for _, allowedField := range allowedSortFields {
|
|
if strings.Contains(contentType, allowedField) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// IsStaticAssist 是否是静态资源
|
|
func IsStaticAssist(contentType string) bool {
|
|
var allowedSortFields = []string{"application/javascript", "text/css", "image/jpeg",
|
|
"image/png", "image/gif", "image/x-icon", "application/html"}
|
|
|
|
for _, allowedField := range allowedSortFields {
|
|
if strings.Contains(contentType, allowedField) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|