Skip to content

Commit

Permalink
fixing a problem I made
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeker12 committed Jul 8, 2024
1 parent 1405fe7 commit 45144d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions httpclient/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *Client) DoRequest(method, endpoint string, body, out interface{}) (*htt
}

if IsIdempotentHTTPMethod(method) {
return c.requestWithRetries(method, endpoint, body)
return c.requestWithRetries(method, endpoint, body, out)
} else if !IsIdempotentHTTPMethod(method) {
return c.request(method, endpoint, body, out)
} else {
Expand Down Expand Up @@ -112,7 +112,7 @@ func (c *Client) DoRequest(method, endpoint string, body, out interface{}) (*htt
// operations.
// - The retry mechanism employs exponential backoff with jitter to mitigate the impact of retries on the server.
// endregion
func (c *Client) requestWithRetries(method, endpoint string, body interface{}) (*http.Response, error) {
func (c *Client) requestWithRetries(method, endpoint string, body, out interface{}) (*http.Response, error) {
var resp *http.Response
var err error
var retryCount int
Expand All @@ -139,7 +139,7 @@ func (c *Client) requestWithRetries(method, endpoint string, body interface{}) (
c.Sugar.Warn("Redirect response received", zap.Int("status_code", resp.StatusCode), zap.String("location", resp.Header.Get("Location")))
}
c.Sugar.Infof("%s request successful at %v", resp.Request.Method, resp.Request.URL)
return resp, nil
return resp, response.HandleAPISuccessResponse(resp, out, c.Sugar)
}

// Message
Expand Down Expand Up @@ -243,7 +243,7 @@ func (c *Client) request(method, endpoint string, body, out interface{}) (*http.
c.Sugar.Warn("Redirect response received", zap.Int("status_code", resp.StatusCode), zap.String("location", resp.Header.Get("Location")))
}
c.Sugar.Infof("%s request successful at %v", resp.Request.Method, resp.Request.URL)
return resp, nil
return resp, response.HandleAPISuccessResponse(resp, out, c.Sugar)
}

return nil, response.HandleAPIErrorResponse(resp, c.Sugar)
Expand Down

0 comments on commit 45144d2

Please sign in to comment.