mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
增加ContentType#get识别的准确率。
This commit is contained in:
@@ -16,4 +16,13 @@ public class ContentTypeTest {
|
||||
String result = ContentType.build(ContentType.JSON, CharsetUtil.CHARSET_UTF_8);
|
||||
Assert.assertEquals("application/json;charset=UTF-8", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetWithLeadingSpace() {
|
||||
String json = " {\n" +
|
||||
" \"name\": \"hutool\"\n" +
|
||||
" }";
|
||||
ContentType contentType = ContentType.get(json);
|
||||
Assert.assertEquals(ContentType.JSON, contentType);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user