@@ -186,8 +186,8 @@ func (c *Client) executeRequestWithRetries(method, endpoint string, body, out in
186186 if resp .StatusCode >= 300 {
187187 log .Warn ("Redirect response received" , zap .Int ("status_code" , resp .StatusCode ), zap .String ("location" , resp .Header .Get ("Location" )))
188188 }
189- // Handle the response as successful, even if it's a redirect .
190- return resp , c . handleSuccessResponse (resp , out , log , method , endpoint )
189+ // Handle the response as successful.
190+ return resp , response . HandleAPISuccessResponse (resp , out , log )
191191 }
192192
193193 // Leverage TranslateStatusCode for more descriptive error logging
@@ -348,11 +348,11 @@ func (c *Client) executeRequest(method, endpoint string, body, out interface{})
348348 if resp .StatusCode >= 300 {
349349 log .Warn ("Redirect response received" , zap .Int ("status_code" , resp .StatusCode ), zap .String ("location" , resp .Header .Get ("Location" )))
350350 }
351- return resp , c .handleSuccessResponse (resp , out , log , method , endpoint )
351+ return resp , response .HandleAPISuccessResponse (resp , out , log )
352+
352353 }
353354
354355 // Handle error responses for status codes outside the successful range
355- //return nil, c.handleErrorResponse(resp, out, log, method, endpoint)
356356 return nil , response .HandleAPIErrorResponse (resp , log )
357357}
358358
@@ -430,19 +430,19 @@ func (c *Client) do(req *http.Request, log logger.Logger, method, endpoint strin
430430//
431431// Returns:
432432// - nil if the response was successfully unmarshalled into the 'out' parameter, or an error if unmarshalling failed.
433- func (c * Client ) handleSuccessResponse (resp * http.Response , out interface {}, log logger.Logger , method , endpoint string ) error {
434- if err := c .APIHandler .HandleAPISuccessResponse (resp , out , log ); err != nil {
435- log .Error ("Failed to unmarshal HTTP response" ,
436- zap .String ("method" , method ),
437- zap .String ("endpoint" , endpoint ),
438- zap .Error (err ),
439- )
440- return err
441- }
442- log .Info ("HTTP request succeeded" ,
443- zap .String ("method" , method ),
444- zap .String ("endpoint" , endpoint ),
445- zap .Int ("status_code" , resp .StatusCode ),
446- )
447- return nil
448- }
433+ // func (c *Client) handleSuccessResponse(resp *http.Response, out interface{}, log logger.Logger, method, endpoint string) error {
434+ // if err := c.APIHandler.HandleAPISuccessResponse(resp, out, log); err != nil {
435+ // log.Error("Failed to unmarshal HTTP response",
436+ // zap.String("method", method),
437+ // zap.String("endpoint", endpoint),
438+ // zap.Error(err),
439+ // )
440+ // return err
441+ // }
442+ // log.Info("HTTP request succeeded",
443+ // zap.String("method", method),
444+ // zap.String("endpoint", endpoint),
445+ // zap.Int("status_code", resp.StatusCode),
446+ // )
447+ // return nil
448+ // }
0 commit comments