mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-26 12:15:44 +08:00
29 lines
443 B
Go
29 lines
443 B
Go
|
package rewrites
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
var allowContentType = []string{
|
||
|
"text/",
|
||
|
"application/xhtml",
|
||
|
"application/xml",
|
||
|
"application/atom+xml",
|
||
|
"application/json",
|
||
|
"application/x-www-form-urlencoded",
|
||
|
}
|
||
|
|
||
|
func CanRewriteBody(contentLength int64, contentType string) bool {
|
||
|
if contentLength <= 0 {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
for _, v := range allowContentType {
|
||
|
if strings.HasPrefix(contentType, v) {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return false
|
||
|
}
|