test: prove Polly resilience handler retries Google's HTTP 429#305
Merged
Conversation
AddGoogleMaps already returns an IHttpClientBuilder, so .AddStandardResilienceHandler() from Microsoft.Extensions.Http.Resilience composes without any core-library dependency on Polly. Add a hermetic regression test proving the standard handler retries a 429 then succeeds, plus a smoke test that it chains off every AddGoogleMaps overload. Expand the README and .agents/dependency-injection.md with the install step, chaining example, and a tuning note (429/408/5xx are retried by default, Retry-After honored, DisableForUnsafeHttpMethods for writes).
🔬 TestGlance✅ 251 passed across 1 job — 95.8% · ⏱️ 12.1s
🟡 build — details✅ 251 passed · ⏭️ 11 skipped vs
Updated 2026-06-15T19:36:57.980Z |
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
AddGoogleMapsalready returns anIHttpClientBuilder, so.AddStandardResilienceHandler()fromMicrosoft.Extensions.Http.Resiliencecomposes onto the Google Maps client without the core library taking any dependency on Polly. This PR proves that path with a regression test and documents it.Related issue
n/a
Changes
GoogleMapsApi.Extensions.DependencyInjection.Test/ResilienceTests.cs: a hermetic test proving the standard handler retries a 429 then succeeds (429 → retry → 200), plus a smoke test that it chains off everyAddGoogleMapsoverload.Microsoft.Extensions.Http.Resilience10.7.0 in the test project only (no new dependency on the core or DI library).README.mdand.agents/dependency-injection.mdwith the install step, chaining example, and a tuning note (429/408/5xx retried by default,Retry-Afterhonored,DisableForUnsafeHttpMethods()for writes).Test plan
dotnet teston the DI test project: 9/9 pass on net8.0 and net10.0 (7 existing + 2 new); the 429 test asserts the fake handler was invoked twice, proving the retry fired.Checklist
dotnet formathas been run.dotnet testpasses locally (DI test project; noGOOGLE_API_KEYneeded — tests are hermetic).