Skip to content

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

Merged
merged 11 commits into from
Jun 6, 2023

Conversation

tangbao0002
Copy link
Contributor

@tangbao0002 tangbao0002 commented May 30, 2023

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

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • dotnet test completes successfully
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@powersj
Copy link
Contributor

powersj commented May 30, 2023

Hi,

Could you please file a GitHub issue and detail why you are after this functionality and what problem you hope to solve?

Thanks

Copy link
Contributor

@bednar bednar left a 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:

  1. Please satisfy the PR checklist:
    image
  2. Please add a test that covers the changes you have made

Copy link
Contributor

@bednar bednar left a 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:

Copy link
Contributor

@bednar bednar left a 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 👍.

Please rebase the PR with the `master' branch and check the checklist when you are done with the PR:

image

After that we are able to merge your PR

@tangbao0002 tangbao0002 requested a review from bednar June 1, 2023 08:31
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

Please resolve the conflict for CHANGELOG.md

image

@tangbao0002 tangbao0002 requested a review from bednar June 2, 2023 13:26
Copy link
Contributor

@bednar bednar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bednar bednar merged commit a926ea1 into influxdata:master Jun 6, 2023
@bednar bednar added this to the 4.13.0 milestone Jun 6, 2023
@alespour
Copy link
Contributor

Closes #495

@alespour
Copy link
Contributor

Closes #516

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.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy