You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: API integrations frequently encounter 429 Too Many Requests. This example will demonstrate how to create a custom http.RoundTripper that automatically pauses and resumes based on server-dictated Retry-After headers.
Architecture & Implementation Requirements:
Setup: Create examples/http_ratelimit/main.go.
The Transport: Implement a custom struct ResilientTransport that wraps http.DefaultTransport.
Integration: Inside the RoundTrip method, wrap the downstream HTTP call in resile.Do.
Header Parsing: If the response is a 429, parse the Retry-After header (handling both integer seconds and HTTP date formats). Have the policy return a custom RateLimitError that implements Resile's RetryAfter() interface.
Acceptance Criteria:
Provide a local mock HTTP server within the example that intentionally returns 429 responses to demonstrate the backoff dynamically.
Document how to inject this RoundTripper seamlessly into an existing http.Client.
Description: API integrations frequently encounter
429 Too Many Requests. This example will demonstrate how to create a customhttp.RoundTripperthat automatically pauses and resumes based on server-dictatedRetry-Afterheaders.Architecture & Implementation Requirements:
examples/http_ratelimit/main.go.ResilientTransportthat wrapshttp.DefaultTransport.RoundTripmethod, wrap the downstream HTTP call inresile.Do.Retry-Afterheader (handling both integer seconds and HTTP date formats). Have the policy return a customRateLimitErrorthat implements Resile'sRetryAfter()interface.Acceptance Criteria:
http.Client.