You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ClientRequestFilter executed on every Client instead of only the one where it is registered. We have two clients:
@RegisterRestClient(configKey = "dad")
@RegisterProvider(TheClientRequestFilter.class)
public interface DadJokeClientWithFilter {
@RegisterRestClient(configKey = "random")
public interface RandomJokeClient {
And the Filter:
public class TheClientRequestFilter implements ClientRequestFilter {
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
Log.info(requestContext.getUri());
}
}
Expected behavior
When I use the clients I would expect the filter only to be executed when the DadJokeClient is used since it is only registered there, but it will also be executed for the RandomJokeClient.
2024-07-12 11:40:19,652 INFO [app.JokeService] (Quarkus Main Thread) Start
2024-07-12 11:40:19,653 INFO [ada.out.TheClientRequestFilter] (Quarkus Main Thread) https://icanhazdadjoke.com/
2024-07-12 11:40:19,886 INFO [app.JokeService] (Quarkus Main Thread) {"id":"1oGYLu4T7Ed","joke":"Why is Peter Pan always flying? Because he Neverlands.","status":200}
2024-07-12 11:40:19,888 INFO [ada.out.TheClientRequestFilter] (Quarkus Main Thread) https://official-joke-api.appspot.com/random_joke
2024-07-12 11:40:20,179 INFO [app.JokeService] (Quarkus Main Thread) {"type":"general","setup":"What do you call a cow with no legs?","punchline":"Ground beef!","id":57}
2024-07-12 11:40:20,179 INFO [app.JokeService] (Quarkus Main Thread) End
The TheClientRequestFilter logs the urls of both clients.
Describe the bug
The ClientRequestFilter executed on every Client instead of only the one where it is registered. We have two clients:
And the Filter:
Expected behavior
When I use the clients I would expect the filter only to be executed when the DadJokeClient is used since it is only registered there, but it will also be executed for the RandomJokeClient.
Actual behavior
This leads to the following output:
The TheClientRequestFilter logs the urls of both clients.
How to Reproduce?
I've created a repo with this demo code here:
https://github.com/Chrisx0385/rest-client-bug-showcase
Output of
uname -a
orver
No response
Output of
java -version
21
Quarkus version or git rev
3.12.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: