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

Use the public class/keyword instead of internal to allow customized HttpClient #270

Open
ddo72 opened this issue Jun 3, 2024 · 2 comments · May be fixed by #277
Open

Use the public class/keyword instead of internal to allow customized HttpClient #270

ddo72 opened this issue Jun 3, 2024 · 2 comments · May be fixed by #277

Comments

@ddo72
Copy link

ddo72 commented Jun 3, 2024

Motivation

Customers want to use a customize httpClient (with proxy) when creating a managementCient.

Proposed solution

Replace internal by public for the following classes:

  • ActionInvoker
  • EndpointUrlBuilder
  • ManagementHttpClient
  • MessageCreator
  • ModelProvider
@pokornyd
Copy link
Member

pokornyd commented Aug 13, 2024

hello and thank you for your submission. could you share some more details on what exactly you're trying to achieve? I see the classes you mentioned are all related to the following interface:

Is your goal to use the internal implementation for implementing this interface, with the exception of httpClient, which should be your custom one?

if that is the case, I think we could add a paramater to ManagementClient constructor or ManagementOptions, which, if present, would make use of the overloaded constructor for ManagementHttpClient to be passed as IHttpProvider parameter.

would the above solution work in your scenario?

@daninden
Copy link

daninden commented Oct 7, 2024

The Management client creates a ManagementHttpClient which creates a new HttpClient, but this is your internal HttpClient type.
There is no option to inject a System.Net.Http.HttpClient into this (with in our case configured proxy settings).
We currently forked the code to make this possible for us.

Our suggestion would be to remove the internally specified/created HttpClient and IHttpClient type (as they conflict with the existing HttpClient), and allow a registered IHttpClient on the ManagementClient.

builder.Services.AddHttpClient<IManagementClient, ManagementClient>() .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler() { Proxy = webProxy });

@daninden daninden linked a pull request Oct 7, 2024 that will close this issue
5 tasks
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 a pull request may close this issue.

3 participants