diff --git a/CHANGELOG.md b/CHANGELOG.md index ad080878e..baa866a4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------------------------------------- -# 5.7.15 (2021-10-16) +# 5.7.15 (2021-10-18) ### 🐣新特性 * 【db 】 Db.quietSetAutoCommit增加判空(issue#I4D75B@Gitee) @@ -11,6 +11,7 @@ * 【core 】 Assert增加checkBetween重载(pr#436@Gitee) * 【core 】 ReUtil增加命名分组重载(pr#439@Gitee) * 【json 】 toString和writer增加Filter(issue#I4DQNQ@Gitee) +* 【core 】 ContentType增加build重载(pr#1898@Github) * ### 🐞Bug修复 * 【core 】 修复CollUtil.isEqualList两个null返回错误问题(issue#1885@Github) diff --git a/hutool-http/src/main/java/cn/hutool/http/ContentType.java b/hutool-http/src/main/java/cn/hutool/http/ContentType.java index d6d998267..29064428c 100644 --- a/hutool-http/src/main/java/cn/hutool/http/ContentType.java +++ b/hutool-http/src/main/java/cn/hutool/http/ContentType.java @@ -45,6 +45,7 @@ public enum ContentType { /** * 构造 + * * @param value ContentType值 */ ContentType(String value) { @@ -141,4 +142,16 @@ public enum ContentType { public static String build(String contentType, Charset charset) { return StrUtil.format("{};charset={}", contentType, charset.name()); } + + /** + * 输出Content-Type字符串,附带编码信息 + * + * @param contentType Content-Type 枚举类型 + * @param charset 编码 + * @return Content-Type字符串 + * @since 5.7.15 + */ + public static String build(ContentType contentType, Charset charset) { + return build(contentType.getValue(), charset); + } }