avivbiton / BlizzardApiReader

.Net Core library to handle Blizzard public APIs
MIT License
35 stars 36 forks source link

HttpClient vs WebClient #42

Closed redmars27 closed 5 years ago

redmars27 commented 5 years ago

I am learning here so I am curious to understand why you used WebClient instead of HttpClient. If you are using Dot Net Core, shouldn't be better to use HttpClient. Let me know if I can help in any way.

avivbiton commented 5 years ago

IWebClient is an interface I made to wrap the HttpClient to make it more testable, it basically uses the HttpClient from .net core
The implementation is very simple, you can see it here: https://github.com/avivbiton/BlizzardApiReader/blob/master/BlizzardApiReader.Core/Models/ApiWebClient.cs

Tell me if you have any further questions.

redmars27 commented 5 years ago

My bad, I didn't see the "i", please, close this issue as incorrect. The only other thing to recommend, please, read this: https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/ as it might have issues if the library is used heavily. Or use dependency injection.

avivbiton commented 5 years ago

Thank you, I will update the IWebClient to use shared instance of HttpClient.