Skip to content

User provided HttpClient support #148

@TomGathercole

Description

@TomGathercole

Looking through the SDK code, it appears that SignNowContext (and indeed anything that inherits WebClientBase) ends up instantiating an HttpClient each time that object is instantiated. This can lead to socket exhaustion and performance issues if used incorrectly (see Issues with the original HttpClient class available in .NET).

Fortunately, it is fairly simple to support integration with HttpClientFactory (without breaking .Net4.5 compatability). There's a couple of ways that could happen in this project:

  • Make SignNowClient public, and make the OAuth2Service and SignNowContext constructors accepting SignNowClient public
  • Add constructors accepting HttpClient to OAuth2Service and SignNowContext, and instantiate a SignNowClient within these classes.

Personally, I think the former would be the simplest approach and I would be happy to work on a PR to implement this. It might be worth noting that this also has other benefits aside from performance including the ability to use middleware like Polly as well as improved testability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions