Skip to content

Commit

Permalink
fix panic in HTTPGetAndAssert
Browse files Browse the repository at this point in the history
Signed-off-by: Vishwas Siravara <[email protected]>
  • Loading branch information
vsiravar committed Jan 6, 2024
1 parent a268e81 commit a7a0964
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fnet/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ import (

// HTTPGetAndAssert sends an HTTP GET request to the specified URL, asserts the response status code against want, and closes the response body.
func HTTPGetAndAssert(url string, want int, maxRetry int, retryInterval time.Duration) {
var err error
var (
err error
resp *http.Response
)
client := http.Client{
Timeout: 5 * time.Second,
}

for i := 0; i < maxRetry; i++ {
// #nosec G107 // it does not matter if url is not a constant for testing.
resp, err := client.Get(url)
resp, err = client.Get(url)
if err != nil {
time.Sleep(retryInterval)
continue
Expand Down

0 comments on commit a7a0964

Please sign in to comment.