-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Made changes in retry_test.go added a function named newRetryHTTP to … #2484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -71,10 +71,15 @@ | |||
| return &http.Response{StatusCode: http.StatusNoContent, Body: http.NoBody}, nil | ||||
| } | ||||
|
|
||||
| func TestRetryProvider_Get(t *testing.T) { | ||||
| // helper to create a retry HTTP instance | ||||
| func newRetryHTTP() HTTP { | ||||
| mockHTTP := &mockHTTP{} | ||||
| retryConfig := &RetryConfig{MaxRetries: 3} | ||||
| retryHTTP := retryConfig.AddOption(mockHTTP) | ||||
| return retryConfig.AddOption(mockHTTP) | ||||
| } | ||||
|
|
||||
| func TestRetryProvider_Get(t *testing.T) { | ||||
| retryHTTP := newRetryHTTP() | ||||
|
|
||||
| // Make the GET request | ||||
| resp, err := retryHTTP.Get(t.Context(), "/test", nil) | ||||
|
|
@@ -85,10 +90,10 @@ | |||
| assert.Equal(t, http.StatusOK, resp.StatusCode) | ||||
| } | ||||
|
|
||||
|
|
||||
| func TestRetryProvider_GetWithHeaders(t *testing.T) { | ||||
| mockHTTP := &mockHTTP{} | ||||
| retryConfig := &RetryConfig{MaxRetries: 3} | ||||
| retryHTTP := retryConfig.AddOption(mockHTTP) | ||||
| retryHTTP := newRetryHTTP() | ||||
|
|
||||
|
|
||||
| // Make the GET request with headers | ||||
| resp, err := retryHTTP.GetWithHeaders(t.Context(), "/test", nil, | ||||
|
|
@@ -101,9 +106,8 @@ | |||
| } | ||||
|
|
||||
| func TestRetryProvider_Post(t *testing.T) { | ||||
| mockHTTP := &mockHTTP{} | ||||
| retryConfig := &RetryConfig{MaxRetries: 3} | ||||
| retryHTTP := retryConfig.AddOption(mockHTTP) | ||||
| retryHTTP := newRetryHTTP() | ||||
|
|
||||
|
|
||||
|
Comment on lines
+109
to
111
|
||||
| // Make the POST request | ||||
| resp, err := retryHTTP.Post(t.Context(), "/test", nil, []byte("body")) | ||||
|
|
@@ -115,9 +119,8 @@ | |||
| } | ||||
|
|
||||
| func TestRetryProvider_PostWithHeaders(t *testing.T) { | ||||
| mockHTTP := &mockHTTP{} | ||||
| retryConfig := &RetryConfig{MaxRetries: 3} | ||||
| retryHTTP := retryConfig.AddOption(mockHTTP) | ||||
| retryHTTP := newRetryHTTP() | ||||
|
|
||||
|
|
||||
|
Comment on lines
+122
to
124
|
||||
| // Make the POST request with headers | ||||
| resp, err := retryHTTP.PostWithHeaders(t.Context(), "/test", nil, []byte("body"), | ||||
|
|
@@ -130,9 +133,8 @@ | |||
| } | ||||
|
|
||||
| func TestRetryProvider_Put(t *testing.T) { | ||||
| mockHTTP := &mockHTTP{} | ||||
| retryConfig := &RetryConfig{MaxRetries: 3} | ||||
| retryHTTP := retryConfig.AddOption(mockHTTP) | ||||
| retryHTTP := newRetryHTTP() | ||||
|
|
||||
|
|
||||
|
Comment on lines
+136
to
138
|
||||
| // Make the PUT request | ||||
| resp, err := retryHTTP.Put(t.Context(), "/test", nil, []byte("body")) | ||||
|
|
@@ -144,9 +146,8 @@ | |||
| } | ||||
|
|
||||
| func TestRetryProvider_PutWithHeaders(t *testing.T) { | ||||
| mockHTTP := &mockHTTP{} | ||||
| retryConfig := &RetryConfig{MaxRetries: 3} | ||||
| retryHTTP := retryConfig.AddOption(mockHTTP) | ||||
| retryHTTP := newRetryHTTP() | ||||
|
|
||||
|
|
||||
|
Comment on lines
+149
to
151
|
||||
| // Make the PUT request with headers | ||||
| resp, err := retryHTTP.PutWithHeaders(t.Context(), "/test", nil, []byte("body"), | ||||
|
|
@@ -182,9 +183,8 @@ | |||
| } | ||||
|
|
||||
| func TestRetryProvider_PatchWithHeaders(t *testing.T) { | ||||
| mockHTTP := &mockHTTP{} | ||||
| retryConfig := &RetryConfig{MaxRetries: 3} | ||||
| retryHTTP := retryConfig.AddOption(mockHTTP) | ||||
| retryHTTP := newRetryHTTP() | ||||
|
|
||||
|
|
||||
|
||||
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] There are two consecutive blank lines after the helper function call. This should be reduced to a single blank line for consistency with coding style.
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] There are two consecutive blank lines after the helper function call. This should be reduced to a single blank line for consistency with coding style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] There are two consecutive blank lines after the helper function call. This should be reduced to a single blank line for consistency with coding style.