Feature/custom http client delegates - #218
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class support for supplying a custom HttpClient or HttpMessageHandler to the downloader pipeline, enabling advanced scenarios like IHttpClientFactory usage, delegating handlers (caching/auth), and custom connection pooling.
Changes:
- Introduces
CustomHttpClientFactoryandCustomHttpMessageHandlerFactoryonDownloadConfigurationand wires them intoSocketClient. - Adds fluent builder methods to configure the above factories via
DownloadBuilder. - Adds integration tests and README documentation for the new injection options.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Downloader/SocketClient.cs | Uses injected HttpClient/handler factories when provided; minor header initialization tweak. |
| src/Downloader/DownloadConfiguration.cs | Adds public configuration delegates for custom HttpClient / HttpMessageHandler. |
| src/Downloader/DownloadBuilder.cs | Adds fluent methods to set the new configuration delegates. |
| src/Downloader.Test/xunit.runner.json | Configures xUnit runner diagnostics/long-running threshold. |
| src/Downloader.Test/IntegrationTests/CustomHttpClientIntegrationTest.cs | Adds integration tests covering custom client/handler injection and precedence rules. |
| src/Downloader.Test/Downloader.Test.csproj | Ensures xunit.runner.json is copied to test output. |
| README.md | Documents how to use custom HttpClient/handler injection and builder equivalents. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…onTest.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…r for custom factory
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…geHandlerFactory with ownership details
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…m factory in SocketClient
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request adds comprehensive support for injecting custom
HttpClientandHttpMessageHandlerinstances into the Downloader library, enabling advanced scenarios like integration withIHttpClientFactory, HTTP caching, and custom authentication. It updates the documentation to explain these new features, introduces a suite of integration tests to ensure correct behavior, and improves test configuration.The most important changes are:
Custom HttpClient/HttpMessageHandler Support:
HttpClientorHttpMessageHandlervia theDownloadConfigurationandDownloadBuilderAPIs, allowing users to control HTTP behavior for advanced use cases. [1] [2] [3] [4]Documentation Updates:
README.mdwith detailed instructions and code samples for using custom HTTP clients and handlers, including builder API usage and precedence rules. [1] [2]Testing Enhancements:
CustomHttpClientIntegrationTest.cswith thorough integration tests covering all combinations of custom client/handler injection, builder API usage, and precedence logic.xunit.runner.jsonto configure test runner diagnostics and long-running test thresholds.These changes make the Downloader library more flexible for real-world enterprise and advanced usage scenarios, while ensuring robust test coverage and improved documentation.