Skip to content
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

Fixes overriding default interceptors and customizing their configuration #1795

Merged
merged 10 commits into from
Nov 19, 2024

Conversation

Ndiritu
Copy link
Contributor

@Ndiritu Ndiritu commented Nov 12, 2024

Building on the work started in #1758.
Thanks @raghusammeta @raghucha

  • Fixes bug in overriding interceptor list
// now works by disregarding the default middleware chain
final OkHttpClient graphClient = GraphClientFactory.create(
   new RetryHandler(), new RedirectHandler()
).build();
  • Enables configuring default interceptors via passing RequestOption. Adds multiple method overloads that accept RequestOption[]
final OkHttpClient graphClient = GraphClientFactory.create(new RequestOption[] {new RetryHandlerOption(null, 0, 0)}).build();

Interceptor[] interceptors = GraphClientFactory.createDefaultGraphInterceptors(
    new RequestOption[] {new RetryHandlerOption(null, 0, 0)}
);
// ... and auth overloads
  • Adds create() overload that accepts a TokenCredential to enable auth in the middleware. Reduces steps needed previously to init an auth provider with an AccessTokenProvider etc
final OkHttpClient graphClient = GraphClientFactory.create(tokenCredential).build();

closes #1757

@Ndiritu Ndiritu force-pushed the fix/handler-overrides branch from aca1a57 to 0e0f2cd Compare November 12, 2024 14:50
@Ndiritu Ndiritu changed the title Fixes overriding default interceptor behaviour Fixes overriding default interceptors and their configuration Nov 12, 2024
@Ndiritu Ndiritu changed the title Fixes overriding default interceptors and their configuration Fixes overriding default interceptors and customizing their configuration Nov 12, 2024
@Ndiritu Ndiritu self-assigned this Nov 12, 2024
@Ndiritu Ndiritu marked this pull request as ready for review November 12, 2024 15:33
@Ndiritu Ndiritu requested a review from a team as a code owner November 12, 2024 15:33
@Ndiritu
Copy link
Contributor Author

Ndiritu commented Nov 12, 2024

Coverage checks still need to be fixed. Bumped the priority here

android/build.gradle Outdated Show resolved Hide resolved
@Ndiritu Ndiritu force-pushed the fix/handler-overrides branch 2 times, most recently from 82c9fe7 to a0eea05 Compare November 19, 2024 09:37
@Ndiritu Ndiritu force-pushed the fix/handler-overrides branch from a0eea05 to 0a815b3 Compare November 19, 2024 10:08
@Ndiritu Ndiritu requested a review from baywet November 19, 2024 10:11
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for cleaning things up!

@Ndiritu Ndiritu merged commit ea73913 into main Nov 19, 2024
10 of 11 checks passed
@Ndiritu Ndiritu deleted the fix/handler-overrides branch November 19, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable overide Any default Interceptor Behaviour
3 participants