when the http request is post method, i want to match readBody predicate, when the request is get method, i don‘t want to match any predicate, how to achieve it?i will appreciate it.
You should use the Method=GET predicate before the read body
@xiaozhiliaoo you could define two different routes, like so:
@Bean
public RouteLocator routeLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route(r -> r.method(HttpMethod.POST).and().readBody(YourClass.class, yourPredicate()).uri("http://example.org"))
.route(r -> r.method(HttpMethod.GET).uri("http://example.org"))
.build();
}