diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java index 75720f2e3af..6ba3f2cfc30 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -199,12 +199,10 @@ public class MockHttpServletResponse implements HttpServletResponse { } public byte[] getContentAsByteArray() { - flushBuffer(); return this.content.toByteArray(); } public String getContentAsString() throws UnsupportedEncodingException { - flushBuffer(); return (this.characterEncoding != null ? this.content.toString(this.characterEncoding) : this.content.toString()); } diff --git a/spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletResponse.java b/spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletResponse.java index 0f555dfb67e..cd8a3909bba 100644 --- a/spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletResponse.java +++ b/spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -192,12 +192,10 @@ public class MockHttpServletResponse implements HttpServletResponse { } public byte[] getContentAsByteArray() { - flushBuffer(); return this.content.toByteArray(); } public String getContentAsString() throws UnsupportedEncodingException { - flushBuffer(); return (this.characterEncoding != null ? this.content.toString(this.characterEncoding) : this.content.toString()); }