Skip to content

Commit

Permalink
Fix usdc http client callAPI (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija42 authored Dec 4, 2024
1 parent 2cbdb83 commit 4e66400
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion execute/tokendata/usdc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ func (h *httpClient) callAPI(ctx context.Context, url url.URL) (cciptypes.Bytes,
req.Header.Add("accept", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
if ctx.Err() != nil && errors.Is(ctx.Err(), context.DeadlineExceeded) {
return nil, http.StatusRequestTimeout, ErrTimeout
} else if errors.Is(err, ErrTimeout) {
return nil, http.StatusRequestTimeout, ErrTimeout
}
// On error, res is nil in most cases, do not read res.StatusCode, return BadRequest
Expand Down

0 comments on commit 4e66400

Please sign in to comment.