You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using ServerRequest.from(other) to augment a ServerRequest in a filter, a new DefaultServerRequestBuilder is returned with body = new byte[0], even if the original ServerRequest has a body. Subsequent filters then get an empty body value. It does appear that the downstream service still does get the correct body, and only other filters are affected.
Sample
Below is a very trivial sample before filter that reproduces the issue. Note: the request body does not need to be read from the original ServerRequest to reproduce this issue, I'm merely doing that in the example to illustrate the issue.
builder.before(request -> {
ServerRequestmodified;
try {
StringrequestBody = request.body(String.class);
modified = ServerRequest.from(request)
.header("X-CUSTOM_HEADER", "value")
.build();
StringmodifiedRequestBody = request.body(String.class);
Assert.isTrue(StringUtils.equals(requestBody, modifiedRequestBody), "Request body should still be the same!");
} catch (Exceptione) {
thrownewRuntimeException(e);
}
returnmodified;
});
The text was updated successfully, but these errors were encountered:
Describe the bug
When using
ServerRequest.from(other)
to augment aServerRequest
in a filter, a newDefaultServerRequestBuilder
is returned withbody = new byte[0]
, even if the original ServerRequest has a body. Subsequent filters then get an empty body value. It does appear that the downstream service still does get the correct body, and only other filters are affected.Sample
Below is a very trivial sample before filter that reproduces the issue. Note: the request body does not need to be read from the original ServerRequest to reproduce this issue, I'm merely doing that in the example to illustrate the issue.
The text was updated successfully, but these errors were encountered: