kloarubeek / SendyClient.Net

A Sendy client, now support for .Net Core!
5 stars 2 forks source link

Allow injecting HttpClient for re-use #7

Open Doddler opened 6 years ago

Doddler commented 6 years ago

Hi, thanks for the handy tool, this simplifies sendy implementation quite a bit.

One thing I noticed though was that the SendyClient creates a new HttpClient for each instance. From what I understand, current wisdom is to re-use an HttpClient for the lifetime of your application. You do have a constructor for injecting an HttpClient, but it is marked internal, and can't be used by an external application. Do you think it would be possible to expose this constructor?

kloarubeek commented 6 years ago

Thanks!

I think it's not a big deal to adjust this. But if you want to re-use the HttpClient, why don't you create a single SendyClient instance in your application? Then the httpClient is also re-used for the lifetime of the application.