Skip to content

HttpClient and using not working well in .NET core #77

Open
@meghuizen

Description

It's about the following code:

using (var client = new HttpClient())

And see the following article for an explanation on this:
https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

But using a singleton (via a static) can also have issues, like:
https://byterot.blogspot.com/2016/07/singleton-httpclient-dns.html

Since with this SDK, you can't really rely on Dependency Injection, I would prefer that all HttpClients, this SDK is using, can be injected and configured with Dependency Injection (which deals with the cleanup as well) and otherwise set 1 HttpClient per instance of the API objects.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions