I am trying to define a Route using Spring's WebFlux modules. Here is my route defintion:
@Bean
public RouterFunction<?> routes(Handler handler) {
Predicate<ServerRequest.Headers> predicate = headers -> headers.equals("clientId");
return
route(GET("/api/v1/client/info").and(headers(predicate)),handler::getInfo);
}
My intent here is to define an GET endPoint with a certain path and the client must provide request header called "clientId". This definition does not work when I make the call to the endPoint. However, if I take the header() part out, the call goes through. What am I missing here ? Kindly advise.
Thank you.