Only clear request attribute when different

With this commit, we now make sure that the attributes are not cleared
if they are same as the nested request.

Issue: SPR-17304
This commit is contained in:
Arjen Poutsma
2018-10-04 15:20:18 +02:00
parent 9975646ffb
commit ff7ccf0d4e
2 changed files with 101 additions and 2 deletions

View File

@@ -940,8 +940,11 @@ public abstract class RouterFunctions {
}
return this.routerFunction.route(nestedRequest)
.doOnNext(match -> {
serverRequest.attributes().clear();
serverRequest.attributes().putAll(nestedRequest.attributes());
if (nestedRequest != serverRequest) {
serverRequest.attributes().clear();
serverRequest.attributes()
.putAll(nestedRequest.attributes());
}
});
}
).orElseGet(Mono::empty);