@@ -70,7 +70,7 @@ func (c *Client) DoRequest(method, endpoint string, body, out interface{}) (*htt
70
70
}
71
71
72
72
if IsIdempotentHTTPMethod (method ) {
73
- return c .requestWithRetries (method , endpoint , body )
73
+ return c .requestWithRetries (method , endpoint , body , out )
74
74
} else if ! IsIdempotentHTTPMethod (method ) {
75
75
return c .request (method , endpoint , body , out )
76
76
} else {
@@ -112,7 +112,7 @@ func (c *Client) DoRequest(method, endpoint string, body, out interface{}) (*htt
112
112
// operations.
113
113
// - The retry mechanism employs exponential backoff with jitter to mitigate the impact of retries on the server.
114
114
// endregion
115
- func (c * Client ) requestWithRetries (method , endpoint string , body interface {}) (* http.Response , error ) {
115
+ func (c * Client ) requestWithRetries (method , endpoint string , body , out interface {}) (* http.Response , error ) {
116
116
var resp * http.Response
117
117
var err error
118
118
var retryCount int
@@ -139,7 +139,7 @@ func (c *Client) requestWithRetries(method, endpoint string, body interface{}) (
139
139
c .Sugar .Warn ("Redirect response received" , zap .Int ("status_code" , resp .StatusCode ), zap .String ("location" , resp .Header .Get ("Location" )))
140
140
}
141
141
c .Sugar .Infof ("%s request successful at %v" , resp .Request .Method , resp .Request .URL )
142
- return resp , nil
142
+ return resp , response . HandleAPISuccessResponse ( resp , out , c . Sugar )
143
143
}
144
144
145
145
// Message
@@ -243,7 +243,7 @@ func (c *Client) request(method, endpoint string, body, out interface{}) (*http.
243
243
c .Sugar .Warn ("Redirect response received" , zap .Int ("status_code" , resp .StatusCode ), zap .String ("location" , resp .Header .Get ("Location" )))
244
244
}
245
245
c .Sugar .Infof ("%s request successful at %v" , resp .Request .Method , resp .Request .URL )
246
- return resp , nil
246
+ return resp , response . HandleAPISuccessResponse ( resp , out , c . Sugar )
247
247
}
248
248
249
249
return nil , response .HandleAPIErrorResponse (resp , c .Sugar )
0 commit comments