Add proxy support to NOAA clients via UseProxy option - #9
Merged
Conversation
Introduce NoaaClientOptions.UseProxy; when enabled, NOAA client requests are routed through the proxy from the Proxy section using AuroraScienceHub.Framework.Http.Proxy. The registration now reads configuration, so AddNoaaClients(IConfiguration) is required. Update the sample and package README, and add unit tests covering disabled proxy, proxy address, credentials, and the missing-address fast-fail case. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds opt-in proxy routing support for the NOAA HTTP clients by introducing a UseProxy flag in NoaaClientOptions and conditionally wiring the framework proxy message handler during DI registration.
Changes:
- Added
NoaaClientOptions.UseProxyand updatedAddNoaaClientsto conditionally configure proxy handling. - Registered proxy options and updated the sample to the new
AddNoaaClients(IConfiguration)signature. - Added unit tests for proxy disabled/enabled, credentials, and missing-address fast-fail; updated package README and changelog.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/UnitTests/NoaaClient/ServiceCollectionExtensionsTests.cs | Adds coverage for proxy wiring behavior and failure mode when proxy config is incomplete. |
| src/NoaaClient/ServiceCollectionExtensions.cs | Adds proxy option registration and conditional primary handler proxy configuration; changes DI registration signature. |
| src/NoaaClient/README.md | Documents UseProxy and Proxy configuration and updates DI registration example. |
| src/NoaaClient/NoaaClientOptions.cs | Introduces the UseProxy option on NOAA client options. |
| samples/NoaaClientSample/Program.cs | Updates sample registration to pass configuration into AddNoaaClients. |
| CHANGELOG.md | Documents the newly added proxy support option (but should also call out the breaking signature change). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
BindConfiguration reads IConfiguration from the DI container at resolve time, which would break when a consumer passes configuration to AddNoaaClients without registering it. Bind both NoaaClientOptions and ProxyOptions directly from the passed instance instead, making the method self-contained. The test helper no longer registers IConfiguration, exercising exactly that scenario. Co-Authored-By: Claude <noreply@anthropic.com>
Add a Changed entry to the Unreleased changelog calling out that AddNoaaClients now requires IConfiguration, and update the main README quick example to pass builder.Configuration. Co-Authored-By: Claude <noreply@anthropic.com>
Set PackageBaseVersion to 1.3.0 and turn the Unreleased changelog section into the 1.3.0 release (proxy support + breaking AddNoaaClients(IConfiguration) signature change), fixing the missing 1.2.2 compare link. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional proxy routing for NOAA HTTP clients through
AuroraScienceHub.Framework.Http.Proxy.Changes
NoaaClientOptionsUseProxyoption (defaultfalse). When enabled, client requests are routed through the proxy configured in theProxysection.ServiceCollectionExtensionsAddNoaaClients()now acceptsIConfiguration;NoaaClientOptionsandProxyOptionsare bound directly from the provided instance, so the method is self-contained (no dependency onIConfigurationbeing registered in DI).ConfigurePrimaryHttpProxyMessageHandler()whenUseProxyis enabled.Sample & docs
NoaaClientSampleand the main README to the newAddNoaaClients(configuration)signature.UseProxy/Proxysections in the package README; flagged the signature change in the changelog.Tests
ServiceCollectionExtensionsTestscovering: proxy disabled, proxy address applied, credentials applied, and missing-address fast-fail (InvalidOperationException) — verified without registeringIConfigurationin DI.Notes
AddNoaaClients()signature change is intentional: the proxy handler is only configured at registration whenUseProxyis enabled, so the flag must be read eagerly.