Closed
Description
Brian Clozel opened SPR-17210 and commented
PathPatternPredicate
is a RequestPredicate
implementation that has side-effects on the request; it modifies the state of request attributes, by adding URI template variables information to it.
This issue is a variant of #21233, but this time using the "and" predicate to chain several predicates.
Consider the following sample:
route(path("/spring/{project}").and(method(HttpMethod.POST)), myHandler::variables)
.andRoute(all(), myHandler::variables);
Given a GET /spring/framework
request, the following happens:
- the path pattern predicate matches and sets the uri template variables
- the and predicate tests the method predicate, which doesn't match
- the "all" predicate matches, and its handler has access to uri template variables that should not be present
Affects: 5.0.8, 5.1 RC2
Issue Links:
- Provide matched pattern information in WebFlux fn [SPR-17098] #21635 Provide matched pattern information in WebFlux fn
- PathPatternPredicate leaves path variables in request even if predicate doesn't match [SPR-16692] #21233 PathPatternPredicate leaves path variables in request even if predicate doesn't match
Referenced from: commits a680880