Skip to content

Commit

Permalink
util: rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan authored and ChrisSchinnerl committed Sep 9, 2024
1 parent 0d0321f commit 33c19cb
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bus/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ func (c *Client) do(req *http.Request, resp interface{}) error {
if c.c.Password != "" {
req.SetBasicAuth("", c.c.Password)
}
_, _, err := utils.SendRequest(req, &resp)
_, _, err := utils.DoRequest(req, &resp)
return err
}
6 changes: 3 additions & 3 deletions bus/client/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (c *Client) PruneMetrics(ctx context.Context, metric string, cutoff time.Ti
panic(err)
}
req.SetBasicAuth("", c.c.WithContext(ctx).Password)
_, _, err = utils.SendRequest(req, nil)
_, _, err = utils.DoRequest(req, nil)
return err
}

Expand All @@ -150,7 +150,7 @@ func (c *Client) recordMetric(ctx context.Context, key string, d interface{}) er
panic(err)
}
req.SetBasicAuth("", c.c.WithContext(ctx).Password)
_, _, err = utils.SendRequest(req, nil)
_, _, err = utils.DoRequest(req, nil)
return err
}

Expand All @@ -167,6 +167,6 @@ func (c *Client) metric(ctx context.Context, key string, values url.Values, res
panic(err)
}
req.SetBasicAuth("", c.c.WithContext(ctx).Password)
_, _, err = utils.SendRequest(req, &res)
_, _, err = utils.DoRequest(req, &res)
return err
}
2 changes: 1 addition & 1 deletion bus/client/slabs.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (c *Client) AddPartialSlab(ctx context.Context, data []byte, minShards, tot
}
req.SetBasicAuth("", c.c.WithContext(ctx).Password)
var apsr api.AddPartialSlabResponse
_, _, err = utils.SendRequest(req, &apsr)
_, _, err = utils.DoRequest(req, &apsr)
if err != nil {
return nil, false, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/bus/forex.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ func (f *client) SiacoinExchangeRate(ctx context.Context, currency string) (rate
}
req.Header.Set("Accept", "application/json")

_, _, err = utils.SendRequest(req, &rate)
_, _, err = utils.DoRequest(req, &rate)
return
}
2 changes: 1 addition & 1 deletion internal/utils/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func OpenBrowser(url string) error {
}
}

func SendRequest(req *http.Request, resp interface{}) (header http.Header, statusCode int, err error) {
func DoRequest(req *http.Request, resp interface{}) (header http.Header, statusCode int, err error) {
r, err := http.DefaultClient.Do(req)
if err != nil {
return nil, 0, err
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,6 @@ func sendEvent(url string, event webhooks.Event) error {
return err
}

_, _, err = utils.SendRequest(req, nil)
_, _, err = utils.DoRequest(req, nil)
return err
}
2 changes: 1 addition & 1 deletion webhooks/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,6 @@ func sendEvent(ctx context.Context, url string, headers map[string]string, actio
req.Header.Set(k, v)
}

_, _, err = utils.SendRequest(req, nil)
_, _, err = utils.DoRequest(req, nil)
return err
}
6 changes: 3 additions & 3 deletions worker/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *Client) HeadObject(ctx context.Context, bucket, path string, opts api.H
req.SetBasicAuth("", c.c.WithContext(ctx).Password)
opts.ApplyHeaders(req.Header)

headers, statusCode, err := utils.SendRequest(req, nil)
headers, statusCode, err := utils.DoRequest(req, nil)
if err != nil && statusCode == http.StatusNotFound {
return nil, api.ErrObjectNotFound
} else if err != nil {
Expand Down Expand Up @@ -219,7 +219,7 @@ func (c *Client) UploadMultipartUploadPart(ctx context.Context, r io.Reader, buc
} else if req.ContentLength, err = sizeFromSeeker(r); err != nil {
return nil, fmt.Errorf("failed to get content length from seeker: %w", err)
}
header, _, err := utils.SendRequest(req, nil)
header, _, err := utils.DoRequest(req, nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func (c *Client) UploadObject(ctx context.Context, r io.Reader, bucket, path str
} else if req.ContentLength, err = sizeFromSeeker(r); err != nil {
return nil, fmt.Errorf("failed to get content length from seeker: %w", err)
}
header, _, err := utils.SendRequest(req, nil)
header, _, err := utils.DoRequest(req, nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 33c19cb

Please sign in to comment.