Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 24 additions & 26 deletions pkg/gofr/service/retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check failure on line 74 in pkg/gofr/service/retry_test.go

View workflow job for this annotation

GitHub Actions / Code Quality🎖️

Comment should end in a period (godot)
func newRetryHTTP() HTTP {
mockHTTP := &mockHTTP{}
retryConfig := &RetryConfig{MaxRetries: 3}
retryHTTP := retryConfig.AddOption(mockHTTP)
return retryConfig.AddOption(mockHTTP)

Check failure on line 78 in pkg/gofr/service/retry_test.go

View workflow job for this annotation

GitHub Actions / Code Quality🎖️

missing whitespace above this line (too many lines above return) (wsl_v5)
}

func TestRetryProvider_Get(t *testing.T) {
retryHTTP := newRetryHTTP()

// Make the GET request
resp, err := retryHTTP.Get(t.Context(), "/test", nil)
Expand All @@ -85,10 +90,10 @@
assert.Equal(t, http.StatusOK, resp.StatusCode)
}


Check failure on line 93 in pkg/gofr/service/retry_test.go

View workflow job for this annotation

GitHub Actions / Code Quality🎖️

File is not properly formatted (gci)
func TestRetryProvider_GetWithHeaders(t *testing.T) {
mockHTTP := &mockHTTP{}
retryConfig := &RetryConfig{MaxRetries: 3}
retryHTTP := retryConfig.AddOption(mockHTTP)
retryHTTP := newRetryHTTP()


Copy link

Copilot AI Nov 6, 2025

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.

Suggested change

Copilot uses AI. Check for mistakes.
// Make the GET request with headers
resp, err := retryHTTP.GetWithHeaders(t.Context(), "/test", nil,
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

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 uses AI. Check for mistakes.
// Make the POST request
resp, err := retryHTTP.Post(t.Context(), "/test", nil, []byte("body"))
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

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 uses AI. Check for mistakes.
// Make the POST request with headers
resp, err := retryHTTP.PostWithHeaders(t.Context(), "/test", nil, []byte("body"),
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

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 uses AI. Check for mistakes.
// Make the PUT request
resp, err := retryHTTP.Put(t.Context(), "/test", nil, []byte("body"))
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

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 uses AI. Check for mistakes.
// Make the PUT request with headers
resp, err := retryHTTP.PutWithHeaders(t.Context(), "/test", nil, []byte("body"),
Expand Down Expand Up @@ -182,9 +183,8 @@
}

func TestRetryProvider_PatchWithHeaders(t *testing.T) {
mockHTTP := &mockHTTP{}
retryConfig := &RetryConfig{MaxRetries: 3}
retryHTTP := retryConfig.AddOption(mockHTTP)
retryHTTP := newRetryHTTP()


Copy link

Copilot AI Nov 6, 2025

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.

Suggested change

Copilot uses AI. Check for mistakes.
// Make the PATCH request with headers
resp, err := retryHTTP.PatchWithHeaders(t.Context(), "/test", nil, []byte("body"),
Expand All @@ -197,9 +197,8 @@
}

func TestRetryProvider_Delete(t *testing.T) {
mockHTTP := &mockHTTP{}
retryConfig := &RetryConfig{MaxRetries: 3}
retryHTTP := retryConfig.AddOption(mockHTTP)
retryHTTP := newRetryHTTP()


Comment on lines +200 to 202
Copy link

Copilot AI Nov 6, 2025

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 uses AI. Check for mistakes.
// Make the DELETE request
resp, err := retryHTTP.Delete(t.Context(), "/test", nil)
Expand All @@ -210,9 +209,8 @@
assert.Equal(t, http.StatusNoContent, resp.StatusCode)
}
func TestRetryProvider_DeleteWithHeaders(t *testing.T) {
mockHTTP := &mockHTTP{}
retryConfig := &RetryConfig{MaxRetries: 3}
retryHTTP := retryConfig.AddOption(mockHTTP)
retryHTTP := newRetryHTTP()


Copy link

Copilot AI Nov 6, 2025

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.

Suggested change

Copilot uses AI. Check for mistakes.
// Make the DELETE request with headers
resp, err := retryHTTP.DeleteWithHeaders(t.Context(), "/test", []byte("body"),
Expand Down
Loading