Skip to content

Commit 160f969

Browse files
committed
Fix: Return correct ByteArrayInputStream object instead of null in some cases
1 parent 2a44914 commit 160f969

File tree

1 file changed

+4
-0
lines changed
  • spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/common

1 file changed

+4
-0
lines changed

spring-cloud-gateway-server-mvc/src/main/java/org/springframework/cloud/gateway/server/mvc/common/MvcUtils.java

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public static ByteArrayInputStream cacheBody(ServerRequest request) {
109109
}
110110
else {
111111
body = getAttribute(request, CACHED_REQUEST_BODY_ATTR);
112+
if (body == null) {
113+
body = new ByteArrayInputStream(bytes);
114+
putAttribute(request, MvcUtils.CACHED_REQUEST_BODY_ATTR, body);
115+
}
112116
}
113117
return body;
114118
}

0 commit comments

Comments
 (0)