-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #4708 refining what is possible via the requestconfig #4837
Conversation
4af7ab0
to
66798c0
Compare
Tried to quickly merge master but it needs more work 😓 |
That's likely - there have been some overlapping changes of late. After this goes in and #4877, then the extra fields will be removed as well. |
Shall we merge #4877 first? (seems cleaner at the moment) |
That's good with me, I'll clean this one up after that. |
@manusa should be good now |
SonarCloud Quality Gate failed. |
} | ||
public interface RequestTags { | ||
|
||
<T> T getTag(Class<T> type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we should document what a Request tag is and what can it be used for
Description
Fixes #4708
There are several goals here. The first is to ensure that only config values that can be changed without creating a new httpclient can be set on the RequestConfig - that means connectionTimeout cannot be there. The next is that allowing for authentication related overrides complicates the logic and any documentation we'd want to create around the refresh interceptors, so it's not a good idea to allow that to be set on a per request basis. It also seems unnecessary to override the oauthtokenprovider as the user already has control over how the token should be provided.
The next goal was to minimize our changes to the Config (the full application of those changes is often unclear and/or may require a new httpclient) - after this the config is nearly immutable and not copied - we're no longer creating copies to override the RequestConfig, nor for the namespace handling. This means that places in the client which were referencing the config to get RequestConfig values were changed to reference a contextual RequestConfig. The only logic that is still modifying the config is the token refresh - and this will likely get refined with #4802.
To clean up how Interceptors reference the config, there is not an explicit parameter that finds tags associated with the request - this is not actually on the HttpRequest as we create those in other places and it's simpler not to have to find the tags that were applicable at that point and only deal with this concept as part of the Interceptors. Due to this and the change to using the standard logic we can pass the full request, not just the headers into the interceptor methods. After #4825 we'll be able to also add a generalized after method for regular requests - this should give us the full set of methods needed to introduce generalized logging interception.
This did not attempt to introduce new entry logic for override the requestconfig - it is still through the withRequestConfig method. If we do provide other DSL entry points for such modifications they should use the same internal method for constructing a new Client / derived HttpClient that will have the appropriate overrides.
This does have conflicts with #4825 - but they will be straight-forward to resolve after one of them is committed.
Type of change
test, version modification, documentation, etc.)
Checklist