FIX: interceptors disapearing on BaseBuilder#clone#2804
FIX: interceptors disapearing on BaseBuilder#clone#2804hosuaby wants to merge 1 commit intoOpenFeign:masterfrom
Conversation
| Feign.Builder enrichedBuilder = originalBuilder.enrich(); | ||
| Feign.Builder enrichedBuilderWithInterceptor = enrichedBuilder.requestInterceptor((req) -> {}); |
There was a problem hiding this comment.
Well, by design enrich is meant to be the last thing you invoke.
After you set all your interceptors, encoders, decodes, you build, and build calls enrich witch will apply modifications to client, encoder and other components.
Doing this you are messing around with the Capability process.
If you wanna see my point, change you Capability on line 73 to do something with the requestInterceptor.
You will see that the capability will be ignored making very hard to anyone to understand why the capability is not working.
Now I don't think we can't have this change
There was a problem hiding this comment.
Yes, @velo
I know it. All interceptors added after enrich was invoked will be not processed by Capability. And this is exactly what my module oauth2 does: https://github.com/hosuaby/feign/blob/feature/oauth2/oauth2/src/main/java/feign/auth/oauth2/OAuth2Authentication.java#L80
This OAuth2Authentication is a Capability that adds interceptor, retryer and errorDecoded just before Feign is built. So they are ignored by any other capability.
Even if you approved my PR already, please follow the link, and check once again. Do you agree with this design?
Hello @velo
I insist on this change that's why I am opening this PR again. This is not a mere style change, but a fix of a very ennoying bug that I have spotted during development of OAuth2 module. I added the test that reproduces the problem. If you revert
BaseBuilder.javathis test will fail.