Merge pull request #31731 from kilink

* pr/31731:
  Avoid byte array copy in getContentAsString

Closes gh-31731
This commit is contained in:
Stéphane Nicoll
2023-12-01 10:58:44 +01:00

View File

@@ -205,7 +205,7 @@ public class ContentCachingRequestWrapper extends HttpServletRequestWrapper {
* @see #getContentAsByteArray()
*/
public String getContentAsString() {
return new String(this.cachedContent.toByteArray(), Charset.forName(getCharacterEncoding()));
return new String(this.cachedContent.toByteArrayUnsafe(), Charset.forName(getCharacterEncoding()));
}
/**