Skip to content

Commit c255a71

Browse files
authored
Merge pull request #49 from deploymenttheory/dev
Refactor DoRequestV2 to DoRequest and add DoMultipartRequest
2 parents 7f32422 + b0bddff commit c255a71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

httpclient/httpclient_request.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"go.uber.org/zap"
1515
)
1616

17-
// DoRequestV2 constructs and executes an HTTP request, choosing the execution path based on the idempotency of the HTTP method.
18-
func (c *Client) DoRequestV2(method, endpoint string, body, out interface{}, log logger.Logger) (*http.Response, error) {
17+
// DoRequest constructs and executes an HTTP request, choosing the execution path based on the idempotency of the HTTP method.
18+
func (c *Client) DoRequest(method, endpoint string, body, out interface{}, log logger.Logger) (*http.Response, error) {
1919
if IsIdempotentHTTPMethod(method) {
2020
return c.executeRequestWithRetries(method, endpoint, body, out, log)
2121
} else if IsNonIdempotentHTTPMethod(method) {
@@ -323,6 +323,7 @@ func (c *Client) handleSuccessResponse(resp *http.Response, out interface{}, log
323323
// Note:
324324
// The function assumes that retryable HTTP methods have been properly defined in the retryableHTTPMethods map.
325325
// It is the caller's responsibility to close the response body when the request is successful to avoid resource leaks.
326+
/*
326327
func (c *Client) DoRequest(method, endpoint string, body, out interface{}, log logger.Logger) (*http.Response, error) {
327328
// Auth Token validation check
328329
valid, err := c.ValidAuthTokenCheck(log)
@@ -557,7 +558,7 @@ func (c *Client) DoRequest(method, endpoint string, body, out interface{}, log l
557558
// TODO refactor to remove repition and to streamline error handling.
558559
return nil, fmt.Errorf("an unexpected error occurred")
559560
}
560-
561+
*/
561562
// DoMultipartRequest creates and executes a multipart HTTP request. It is used for sending files
562563
// and form fields in a single request. This method handles the construction of the multipart
563564
// message body, setting the appropriate headers, and sending the request to the given endpoint.

0 commit comments

Comments
 (0)