dromara / hutool

🍬A set of tools that keep Java sweet.
https://hutool.cn
Other
28.91k stars 7.48k forks source link

增加ContentType#get识别的准确率。 #3664

Closed tian-pengfei closed 1 month ago

tian-pengfei commented 1 month ago
  1. [bug修复] ContentType#get方法处理JSON字符串时,如果首字符为空格时无法识别
        @Test
    public void testGetWithLeadingSpace() {
        String json = " {\n" +
            "     \"name\": \"hutool\"\n" +
            " }";
        ContentType contentType = ContentType.get(json);
        Assert.assertEquals(ContentType.JSON, contentType);
    }
looly commented 1 month ago

确实无伤大雅,合并吧。