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

Should SendGridClient accept an IHttpClient in the constructor instead of creating it's own? #847

Closed
PureKrome opened this issue Jan 10, 2019 · 2 comments
Labels
difficulty: unknown or n/a fix is unknown in difficulty status: duplicate duplicate issue

Comments

@PureKrome
Copy link

Issue Summary

As part of learning if SendGridClient is thread safe, I noticed that there is not ctor that accepts an IHttpClient and that the ctor actually creates the HttpClient.

I was wondering if it's worth leveraging the new HttpClientFactory stuff available from .NET Core 2.1+ (which can also handle Polly retries, etc) plus some other magic-under-the-hood.

@thinkingserious
Copy link
Contributor

Hi @PureKrome,

I'm going to reference this issue here: #521

Short answer is that we have not gotten to this issue in our backlog just yet. We are definitely open to PRs if your up for it.

With Best Regards,

Elmer

@anupkattel
Copy link

There is a constructor that takes HttpClient. I think you can just use that to inject it with something like:

services.AddHttpClient<ISendGridClient, SendGridClient>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: unknown or n/a fix is unknown in difficulty status: duplicate duplicate issue
Projects
None yet
Development

No branches or pull requests

4 participants