Skip to content

fix: use default retry hooks for zero-value Client#293

Open
happysnaker wants to merge 1 commit into
hashicorp:mainfrom
happysnaker:fix-zero-value-client-default-policies
Open

fix: use default retry hooks for zero-value Client#293
happysnaker wants to merge 1 commit into
hashicorp:mainfrom
happysnaker:fix-zero-value-client-default-policies

Conversation

@happysnaker

Copy link
Copy Markdown

Summary

  • fall back to DefaultRetryPolicy when Client.CheckRetry is nil
  • fall back to DefaultBackoff when Client.Backoff is nil
  • add regression coverage showing a manually constructed zero-value Client no longer panics and still retries

Why

NewClient() initializes these hooks, but the Client type is public and issue #108 reports a real panic when callers construct &retryablehttp.Client{} directly. This change keeps that usage from crashing in Do() while preserving the existing behavior for fully initialized clients.

Closes #108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do() should checks about CheckRetry value before calling it

1 participant