Skip to content

Commit

Permalink
remove message
Browse files Browse the repository at this point in the history
  • Loading branch information
dwertent committed Dec 12, 2023
1 parent 9b1fdd8 commit cfc1f22
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/client/v1/httpreportsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ type HttpReportSender struct {
httpClient httputils.IHttpClient
}

// Send - send http request. returns-> http status code, return message (jobID/OK), http/go error
// Send sends an HTTP request to a server and returns the HTTP status code, return message, and any errors.
func (s *HttpReportSender) Send(serverURL string, headers map[string]string, reqBody []byte) (int, string, error) {

var resp *http.Response
var err error
var bodyAsStr string
Expand All @@ -42,20 +41,16 @@ func (s *HttpReportSender) Send(serverURL string, headers map[string]string, req
if !retry {
break
}
//else err != nil
e := fmt.Errorf("attempt #%d - Failed posting report. Url: '%s', reason: '%s' report: '%s' response: '%s'", i, serverURL, err.Error(), string(reqBody), bodyAsStr)

if i == MAX_RETRIES-1 {
return 500, e.Error(), err
return 500, "", err
}
//wait 5 secs between retries
time.Sleep(RETRY_DELAY)
}
if resp == nil {
return 500, bodyAsStr, fmt.Errorf("failed to send report, empty response: %w", err)
}
return resp.StatusCode, bodyAsStr, nil

}

type HttpReportSenderMock struct {
Expand Down

0 comments on commit cfc1f22

Please sign in to comment.