-
Notifications
You must be signed in to change notification settings - Fork 96
feat: add HttpClient as a part of InfluxDBClientOptions #528
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
Conversation
Hi, Could you please file a GitHub issue and detail why you are after this functionality and what problem you hope to solve? Thanks |
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.
Hi @tangbao0002,
thanks for your PR and your clarification:
The caller can create a RestClient themselves through this constructor 'public RestClient(HttpClient httpClient, RestClientOptions options, bool disposeHttpClient = false)'. And this HttpClientMessageHandler instances will be managed by the dependency injection container.
It is also recommended in Microsoft documentation to send HTTP requests by injecting an HTTP client instead of creating an HTTP client instance every time(https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-7.0).
Before we accept the PR, there are a few requirements that must be met:
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.
Thanks again for your PR 👍
Before we accept the PR, there are a few requirements that must be met:
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.
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.
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.
LGTM 👍
Closes #495 |
Closes #516 |
Add httpclient as a part of InfluxbOption to allow injection of custom HttpMessageHandler(#516).
_Briefly describe your proposed changes:
The caller can create a RestClient themselves through this constructor 'public RestClient(HttpClient httpClient, RestClientOptions options, bool disposeHttpClient = false)'. And this HttpClientMessageHandler instances will be managed by the dependency injection container.
It is also recommended in Microsoft documentation to send HTTP requests by injecting an HTTP client instead of creating an HTTP client instance every time(https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-7.0).
Checklist
dotnet test
completes successfully