Skip to content

Commit d6e3394

Browse files
committed
Polishing
See gh-23219
1 parent b4a0e71 commit d6e3394

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletResponse.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ public byte[] getContentAsByteArray() {
207207
}
208208

209209
/**
210-
* Get the content of the response body as a {@code String}, using the configured
211-
* {@linkplain #getCharacterEncoding character encoding}.
210+
* Get the content of the response body as a {@code String}, using the charset
211+
* specified for the response by the application, either through
212+
* {@link HttpServletResponse} methods or through a charset parameter on the
213+
* {@code Content-Type}.
212214
* @return the content as a {@code String}
213215
* @throws UnsupportedEncodingException if the character encoding is not supported
214216
* @see #getContentAsString(Charset)
@@ -221,12 +223,15 @@ public String getContentAsString() throws UnsupportedEncodingException {
221223
/**
222224
* Get the content of the response body as a {@code String}, using the provided
223225
* {@code fallbackCharset} if no charset has been explicitly defined and otherwise
224-
* using the configured {@linkplain #getCharacterEncoding character encoding}.
226+
* using the charset specified for the response by the application, either
227+
* through {@link HttpServletResponse} methods or through a charset parameter on the
228+
* {@code Content-Type}.
225229
* @return the content as a {@code String}
226230
* @throws UnsupportedEncodingException if the character encoding is not supported
227231
* @since 5.2
228232
* @see #getContentAsString()
229233
*/
234+
230235
public String getContentAsString(Charset fallbackCharset) throws UnsupportedEncodingException {
231236
return isCharset() ?
232237
this.content.toString(this.characterEncoding) :

0 commit comments

Comments
 (0)