Browse Source

Merge pull request #31731 from kilink

* pr/31731:
  Avoid byte array copy in getContentAsString

Closes gh-31731
pull/31737/head
Stéphane Nicoll 2 years ago
parent
commit
0dbb0f5c14
  1. 2
      spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java

2
spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java

@ -205,7 +205,7 @@ public class ContentCachingRequestWrapper extends HttpServletRequestWrapper { @@ -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()));
}
/**

Loading…
Cancel
Save