mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
improve package gjson for automatic content type checking
This commit is contained in:
parent
ed479e2a13
commit
eacad9b453
@ -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) &&
|
||||
|
Loading…
Reference in New Issue
Block a user