mirror of
https://gitee.com/johng/gf
synced 2026-07-09 06:50:30 +08:00
improve package gjson for automatic content type checking
This commit is contained in:
@ -207,7 +207,8 @@ func checkDataType(content []byte) string {
|
||||
return "json"
|
||||
} else if gregex.IsMatch(`^<.+>[\S\s]+<.+>$`, content) {
|
||||
return "xml"
|
||||
} else if gregex.IsMatch(`[\s\t\n]*[\w\-]+\s*:\s*.+`, content) {
|
||||
} else if gregex.IsMatch(`[\s\t\n]*[\w\-]+\s*:\s*".+"`, content) ||
|
||||
gregex.IsMatch(`[\s\t\n]*[\w\-]+\s*:\s*\w+`, content) {
|
||||
return "yml"
|
||||
} else if gregex.IsMatch(`\[[\w]+\]`, content) &&
|
||||
gregex.IsMatch(`[\s\t\n\[\]]*[\w\-]+\s*=\s*.+`, content) &&
|
||||
|
||||
Reference in New Issue
Block a user