Merge pull request #1896 from lnsane/v5-dev

增加ContentType新的构建方法
This commit is contained in:
Golden Looly 2021-10-18 16:48:19 +08:00 committed by GitHub
commit 0d653aaa5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
}