parent
c31613dc74
commit
5c2f3079fd
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -193,7 +193,8 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
|||
Assert.state(this.writerAccessAllowed, "Writer access not allowed");
|
||||
if (this.writer == null) {
|
||||
Writer targetWriter = (this.characterEncoding != null ?
|
||||
new OutputStreamWriter(this.content, this.characterEncoding) : new OutputStreamWriter(this.content));
|
||||
new OutputStreamWriter(this.content, this.characterEncoding) :
|
||||
new OutputStreamWriter(this.content));
|
||||
this.writer = new ResponsePrintWriter(targetWriter);
|
||||
}
|
||||
return this.writer;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +193,8 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
|||
Assert.state(this.writerAccessAllowed, "Writer access not allowed");
|
||||
if (this.writer == null) {
|
||||
Writer targetWriter = (this.characterEncoding != null ?
|
||||
new OutputStreamWriter(this.content, this.characterEncoding) : new OutputStreamWriter(this.content));
|
||||
new OutputStreamWriter(this.content, this.characterEncoding) :
|
||||
new OutputStreamWriter(this.content));
|
||||
this.writer = new ResponsePrintWriter(targetWriter);
|
||||
}
|
||||
return this.writer;
|
||||
|
|
|
|||
Loading…
Reference in New Issue