改进ContentType.get忽略空格

This commit is contained in:
Looly
2024-07-31 00:23:59 +08:00
parent 0e402d2d2b
commit ae3e6d4fad
2 changed files with 14 additions and 2 deletions

View File

@@ -132,7 +132,7 @@ public enum ContentType {
public static ContentType get(final String body) {
ContentType contentType = null;
if (StrUtil.isNotBlank(body)) {
final char firstChar = body.charAt(0);
final char firstChar = StrUtil.trimPrefix(body).charAt(0);
switch (firstChar) {
case '{':
case '[':