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..4ba89894f 100644 --- a/hutool-http/src/main/java/cn/hutool/http/ContentType.java +++ b/hutool-http/src/main/java/cn/hutool/http/ContentType.java @@ -141,4 +141,15 @@ 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字符串 + */ + public static String build(ContentType contentType, Charset charset) { + this.build(contentType.getValue(),charset); + } }