Merge branch 'dev' into 'main'

This commit is contained in:
stSolo
2022-08-18 10:57:29 +03:00
parent db4b8a4e9e
commit 96ce997ecc
4 changed files with 73 additions and 6 deletions

View File

@@ -18,6 +18,10 @@ type Client struct {
}
func New(cfg config.Config) *Client {
if cfg.Retries == 0 {
cfg.Retries = 5
}
return &Client{
decortUrl: cfg.DecortURL,
client: client.NewHttpClient(cfg),
@@ -31,7 +35,10 @@ func (dc *Client) DecortApiCall(ctx context.Context, method, url string, params
}
body := strings.NewReader(values.Encode())
req, _ := http.NewRequestWithContext(ctx, method, dc.decortUrl+"/restmachine"+url, body)
req, err := http.NewRequestWithContext(ctx, method, dc.decortUrl+"/restmachine"+url, body)
if err != nil {
return nil, err
}
resp, err := dc.client.Do(req)
if err != nil {