Skip to content

Commit

Permalink
remove unused vars
Browse files Browse the repository at this point in the history
  • Loading branch information
suryagupta4 committed Feb 25, 2025
1 parent 0f4320e commit 0e8f44e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api/api_logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestLogRequest(t *testing.T) {
originalDumpRequest := dumpRequest
defer func() { dumpRequest = originalDumpRequest }()

dumpRequest = func(req *http.Request, body bool) ([]byte, error) {
dumpRequest = func(_ *http.Request, _ bool) ([]byte, error) {
return nil, errors.New("DumpRequest failed")
}

Expand All @@ -130,14 +130,14 @@ func TestLogRequest(t *testing.T) {
// Mock DumpRequest to succeed
originalDumpRequest := dumpRequest
defer func() { dumpRequest = originalDumpRequest }()
dumpRequest = func(res *http.Request, body bool) ([]byte, error) {
dumpRequest = func(_ *http.Request, _ bool) ([]byte, error) {
return []byte("request body"), nil
}

// Mock WriteIndented to return an error
originalWriteIndented := writeIndented
defer func() { writeIndented = originalWriteIndented }()
writeIndented = func(w io.Writer, b []byte) error {
writeIndented = func(_ io.Writer, _ []byte) error {
return errors.New("WriteIndented failed")
}

Expand Down Expand Up @@ -190,7 +190,7 @@ func TestLogResponse(t *testing.T) {
})

// Test case: Response with error in DumpResponse
t.Run("Response with error in DumpResponse", func(t *testing.T) {
t.Run("Response with error in DumpResponse", func(_ *testing.T) {
res := &http.Response{
Header: http.Header{
"Content-Type": []string{"application/json"},
Expand All @@ -201,7 +201,7 @@ func TestLogResponse(t *testing.T) {
originalDumpResponse := dumpResponse
defer func() { dumpResponse = originalDumpResponse }()

dumpResponse = func(req *http.Response, body bool) ([]byte, error) {
dumpResponse = func(_ *http.Response, _ bool) ([]byte, error) {
return nil, errors.New("DumpResponse failed")
}

Expand All @@ -210,7 +210,7 @@ func TestLogResponse(t *testing.T) {
})

// Test case: Response with error in WriteIndented
t.Run("Failure in WriteIndented", func(t *testing.T) {
t.Run("Failure in WriteIndented", func(_ *testing.T) {
res := &http.Response{
Header: http.Header{
"Content-Type": []string{"application/json"},
Expand All @@ -220,14 +220,14 @@ func TestLogResponse(t *testing.T) {
// Mock DumpResponse to succeed
originalDumpResponse := dumpResponse
defer func() { dumpResponse = originalDumpResponse }()
dumpResponse = func(res *http.Response, body bool) ([]byte, error) {
dumpResponse = func(_ *http.Response, _ bool) ([]byte, error) {
return []byte("response body"), nil
}

// Mock WriteIndented to return an error
originalWriteIndented := writeIndented
defer func() { writeIndented = originalWriteIndented }()
writeIndented = func(w io.Writer, b []byte) error {
writeIndented = func(_ io.Writer, _ []byte) error {
return errors.New("WriteIndented failed")
}

Expand Down

0 comments on commit 0e8f44e

Please sign in to comment.