Skip to content

Commit 108e1de

Browse files
committed
test(httpclient): replace nil with http.NoBody in HTTP requests
Replace `nil` body parameter with `http.NoBody` in test HTTP requests to follow Go best practices and make the intent more explicit when no request body is needed.
1 parent 8073fc3 commit 108e1de

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/httpclient/client_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestWithModelName(t *testing.T) {
4040
defer srv.Close()
4141

4242
client := NewHTTPClient(WithModelName(tt.modelName))
43-
req, err := http.NewRequest(http.MethodGet, srv.URL, nil)
43+
req, err := http.NewRequest(http.MethodGet, srv.URL, http.NoBody)
4444
require.NoError(t, err)
4545

4646
resp, err := client.Do(req)
@@ -66,7 +66,7 @@ func TestWithModel(t *testing.T) {
6666
defer srv.Close()
6767

6868
client := NewHTTPClient(WithModel("gpt-4o"))
69-
req, err := http.NewRequest(http.MethodGet, srv.URL, nil)
69+
req, err := http.NewRequest(http.MethodGet, srv.URL, http.NoBody)
7070
require.NoError(t, err)
7171

7272
resp, err := client.Do(req)
@@ -86,7 +86,7 @@ func TestWithProvider(t *testing.T) {
8686
defer srv.Close()
8787

8888
client := NewHTTPClient(WithProvider("openai"))
89-
req, err := http.NewRequest(http.MethodGet, srv.URL, nil)
89+
req, err := http.NewRequest(http.MethodGet, srv.URL, http.NoBody)
9090
require.NoError(t, err)
9191

9292
resp, err := client.Do(req)

0 commit comments

Comments
 (0)