jgiacomini / Tiny.RestClient

Simpliest Fluent REST client for .NET
MIT License
210 stars 30 forks source link

TinyRestClient, usage pattern #111

Closed wahmedswl closed 4 years ago

wahmedswl commented 4 years ago

Hi, thanks for this nice library. Wanted to know if var client = new TinyRestClient(new HttpClient(), "http://MyAPI.com/api"); object should be created globally and 1 per application just like recommended for HttpClient or should be used with using pattern.

Thanks

jgiacomini commented 4 years ago

Hello,

If you are in .NET Core I strongly recommand you to use IHttpClientFactory to create HttpClient for each controller. :)

Please find the documentation below : https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1