Merge branch '6.1.x'
This commit is contained in:
@@ -412,7 +412,8 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
private void updateContentTypeHeader() {
|
||||
if (StringUtils.hasLength(this.contentType)) {
|
||||
String value = this.contentType;
|
||||
if (StringUtils.hasLength(this.characterEncoding) && !this.contentType.toLowerCase().contains(CHARSET_PREFIX)) {
|
||||
if (StringUtils.hasLength(this.characterEncoding) &&
|
||||
!this.contentType.toLowerCase(Locale.ROOT).contains(CHARSET_PREFIX)) {
|
||||
value += ';' + CHARSET_PREFIX + this.characterEncoding;
|
||||
}
|
||||
doAddHeaderValue(HttpHeaders.CONTENT_TYPE, value, true);
|
||||
@@ -490,7 +491,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// Try to get charset value anyway
|
||||
contentType = contentType.toLowerCase();
|
||||
contentType = contentType.toLowerCase(Locale.ROOT);
|
||||
int charsetIndex = contentType.indexOf(CHARSET_PREFIX);
|
||||
if (charsetIndex != -1) {
|
||||
this.characterEncoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length());
|
||||
|
||||
@@ -226,7 +226,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
String value = this.contentType;
|
||||
int charsetIndex = value.toLowerCase().indexOf(CHARSET_PREFIX);
|
||||
int charsetIndex = value.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX);
|
||||
if (charsetIndex != -1) {
|
||||
value = value.substring(0, charsetIndex).trim();
|
||||
if (value.endsWith(";")) {
|
||||
@@ -246,7 +246,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
private void updateContentTypePropertyAndHeader() {
|
||||
if (this.contentType != null) {
|
||||
String value = this.contentType;
|
||||
if (this.characterEncodingSet && !value.toLowerCase().contains(CHARSET_PREFIX)) {
|
||||
if (this.characterEncodingSet && !value.toLowerCase(Locale.ROOT).contains(CHARSET_PREFIX)) {
|
||||
value += ';' + CHARSET_PREFIX + getCharacterEncoding();
|
||||
this.contentType = value;
|
||||
}
|
||||
@@ -358,7 +358,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// Try to get charset value anyway
|
||||
int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX);
|
||||
int charsetIndex = contentType.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX);
|
||||
if (charsetIndex != -1) {
|
||||
setExplicitCharacterEncoding(contentType.substring(charsetIndex + CHARSET_PREFIX.length()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user