diff --git a/cmd/src/gateway_benchmark.go b/cmd/src/gateway_benchmark.go index ef3749fb8f..93d6f99ea1 100644 --- a/cmd/src/gateway_benchmark.go +++ b/cmd/src/gateway_benchmark.go @@ -166,12 +166,12 @@ func benchmarkEndpointHTTP(client *http.Client, url string) time.Duration { fmt.Printf("Error calling %s: %v\n", url, err) return 0 } - defer func(body io.ReadCloser) { - err := body.Close() + defer func() { + err := resp.Body.Close() if err != nil { fmt.Printf("Error closing response body: %v\n", err) } - }(resp.Body) + }() _, err = io.ReadAll(resp.Body) if err != nil {