@@ -71,8 +71,8 @@ func (c *HttpClient) Delete(ctx context.Context, name, path string, requestBody
7171 return c .connectionWithRetries (ctx , http .MethodDelete , name , path , nil , requestBody , responseBody )
7272}
7373
74- func (c * HttpClient ) DeleteWithQuery (ctx context.Context , name , path string , requestBody interface {}, responseBody interface {}) error {
75- return c .connectionWithRetries (ctx , http .MethodDelete , name , path , nil , requestBody , responseBody )
74+ func (c * HttpClient ) DeleteWithQuery (ctx context.Context , name , path string , query url. Values , requestBody interface {}, responseBody interface {}) error {
75+ return c .connectionWithRetries (ctx , http .MethodDelete , name , path , query , requestBody , responseBody )
7676}
7777
7878func (c * HttpClient ) connectionWithRetries (ctx context.Context , method , name , path string , query url.Values , requestBody interface {}, responseBody interface {}) error {
@@ -88,7 +88,7 @@ func (c *HttpClient) connectionWithRetries(ctx context.Context, method, name, pa
8888 }
8989 var target * HTTPError
9090 if errors .As (err , & target ) && target .StatusCode == http .StatusTooManyRequests {
91- c .logger .Println (fmt . Sprintf ( "status code 429 received, request will be retried" ) )
91+ c .logger .Println ("status code 429 received, request will be retried" )
9292 return true
9393 }
9494 return false
@@ -126,14 +126,13 @@ func (c *HttpClient) connection(ctx context.Context, method, name, path string,
126126 }
127127
128128 request , err := http .NewRequestWithContext (ctx , method , u , body )
129-
130- // The API expects this entry in the header in all requests.
131- request .Header .Set ("Content-Type" , "application/json" )
132-
133129 if err != nil {
134130 return fmt .Errorf ("failed to create request to %s: %w" , name , err )
135131 }
136132
133+ // The API expects this entry in the header in all requests.
134+ request .Header .Set ("Content-Type" , "application/json" )
135+
137136 response , err := c .client .Do (request )
138137 if err != nil {
139138 return fmt .Errorf ("failed to %s: %w" , name , err )
@@ -149,7 +148,7 @@ func (c *HttpClient) connection(ctx context.Context, method, name, path string,
149148 }
150149 }
151150
152- defer response .Body .Close ()
151+ defer func () { _ = response .Body .Close () } ()
153152
154153 if response .StatusCode > 299 {
155154 body , _ := io .ReadAll (response .Body )
0 commit comments