Skip to content

Commit

Permalink
Support reading the body multiple times in ReadBodyRoutePredicateFact…
Browse files Browse the repository at this point in the history
…ory.
  • Loading branch information
qnnn committed Oct 3, 2024
1 parent 9c16586 commit ecd094b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public Publisher<Boolean> apply(ServerWebExchange exchange) {
.getAttribute(ServerWebExchangeUtils.CACHED_SERVER_HTTP_REQUEST_DECORATOR_ATTR);
if (mutableRequest != null) {
return ServerRequest.create(exchange.mutate().request(mutableRequest).build(), messageReaders)
.bodyToMono(config.getInClass()).doOnNext(objectValue -> exchange.getAttributes()
.bodyToMono(config.getInClass())
.doOnNext(objectValue -> exchange.getAttributes()
.put(CACHE_REQUEST_BODY_OBJECT_KEY, objectValue))
.map(objectValue -> {
boolean test = config.getPredicate().test(objectValue);
Expand All @@ -81,7 +82,8 @@ public Publisher<Boolean> apply(ServerWebExchange exchange) {
return ServerWebExchangeUtils.cacheRequestBodyAndRequest(exchange,
(serverHttpRequest) -> ServerRequest
.create(exchange.mutate().request(serverHttpRequest).build(), messageReaders)
.bodyToMono(config.getInClass()).doOnNext(objectValue -> exchange.getAttributes()
.bodyToMono(config.getInClass())
.doOnNext(objectValue -> exchange.getAttributes()
.put(CACHE_REQUEST_BODY_OBJECT_KEY, objectValue))
.map(objectValue -> {
boolean test = config.getPredicate().test(objectValue);
Expand Down

0 comments on commit ecd094b

Please sign in to comment.