Page MenuHomeAITSYS Dev

[Core] Use (and expose) a single `HttpClient`
Open, WishlistPublic

Description

The .NET HttpClient is meant to be used with a singleton pattern, i.e. only one should exist within a single program. At the moment I think DisCatSharp doesn't make loads of these but it's worth checking if more than one ever exists at once. DisCatSharp should expose the HttpClient it uses internally to the user as a readonly field so that they can use it for their own requests. DisCatSharp could also allow the user to pass in their own HttpClient via configuration struct that the library would then use.

I'm not sure what the best way to handle headers is yet - perhaps creating a helper method that uses the appropriate headers for internal library calls, allowing the user to have different headers for their own calls.

Related Objects

Event Timeline

Nyuw triaged this task as Wishlist priority.Oct 18 2021, 16:45
Nyuw created this task.
Nyuw created this object with edit policy "DisCatSharp (Project)".
Nyuw added projects: DisCatSharp, Restricted Project, Restricted Project.
Nyuw edited subscribers, added: DisCatSharp, DisCatSharp Contributor, Restricted Project; removed: Nyuw.
aiko moved this task from Backlog to In Progress on the DisCatSharp board.