Simplify String concatenation
This commit is contained in:
committed by
Juergen Hoeller
parent
9d2e7ced89
commit
29f382b04e
@@ -403,12 +403,11 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private void updateContentTypeHeader() {
|
||||
if (StringUtils.hasLength(this.contentType)) {
|
||||
StringBuilder sb = new StringBuilder(this.contentType);
|
||||
if (!this.contentType.toLowerCase().contains(CHARSET_PREFIX) &&
|
||||
StringUtils.hasLength(this.characterEncoding)) {
|
||||
sb.append(";").append(CHARSET_PREFIX).append(this.characterEncoding);
|
||||
String value = this.contentType;
|
||||
if (StringUtils.hasLength(this.characterEncoding) && !this.contentType.toLowerCase().contains(CHARSET_PREFIX)) {
|
||||
value += ';' + CHARSET_PREFIX + this.characterEncoding;
|
||||
}
|
||||
doAddHeaderValue(HttpHeaders.CONTENT_TYPE, sb.toString(), true);
|
||||
doAddHeaderValue(HttpHeaders.CONTENT_TYPE, value, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user