Skip to content

Commit

Permalink
Handle NewRequestWithContext error
Browse files Browse the repository at this point in the history
  • Loading branch information
GitRowin committed Jun 24, 2024
1 parent 3edfd93 commit 001ea80
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ func sendRequest(client *http.Client, ctx context.Context, targetUrl string) (*S
// Make a new GET request with the client trace
req, err := http.NewRequestWithContext(httptrace.WithClientTrace(ctx, trace), "GET", targetUrl, nil)

if err != nil {
return statistics, err
}

req.Header.Set("User-Agent", userAgent)

// Send the request
Expand Down

0 comments on commit 001ea80

Please sign in to comment.