提交 1c24dc1f 编写于 作者: S stsypanov 提交者: Juergen Hoeller

Simplify String concatenation

上级 dc8fb8bc
......@@ -168,11 +168,11 @@ public class MockHttpServletResponse implements HttpServletResponse {
private void updateContentTypeHeader() {
if (this.contentType != null) {
StringBuilder sb = new StringBuilder(this.contentType);
if (!this.contentType.toLowerCase().contains(CHARSET_PREFIX) && this.charset) {
sb.append(";").append(CHARSET_PREFIX).append(this.characterEncoding);
String value = this.contentType;
if (this.charset && !this.contentType.toLowerCase().contains(CHARSET_PREFIX)) {
value = value + ';' + CHARSET_PREFIX + this.characterEncoding;
}
doAddHeaderValue(HttpHeaders.CONTENT_TYPE, sb.toString(), true);
doAddHeaderValue(HttpHeaders.CONTENT_TYPE, value, true);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册