chore: remove refs to deprecated io/ioutil
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -119,7 +118,7 @@ func TestRecordMetricsForNonExistingOperation(t *testing.T) {
|
||||
if err != nil || rsp.StatusCode != http.StatusOK {
|
||||
t.Errorf("failed to get response from server %v, %v", err, rsp)
|
||||
}
|
||||
r, err := ioutil.ReadAll(rsp.Body)
|
||||
r, err := io.ReadAll(rsp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("failed to read response body %v", err)
|
||||
}
|
||||
@@ -144,7 +143,7 @@ func TestDropOperation(t *testing.T) {
|
||||
if err != nil || rsp.StatusCode != http.StatusOK {
|
||||
t.Errorf("failed to get response from server %v, %v", err, rsp)
|
||||
}
|
||||
r, err := ioutil.ReadAll(rsp.Body)
|
||||
r, err := io.ReadAll(rsp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("failed to read response body %v", err)
|
||||
}
|
||||
@@ -554,7 +553,7 @@ func verifyInFlightMetric(expected string, srvAddr string) error {
|
||||
if rsp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("failed to get response from serve: %s", http.StatusText(rsp.StatusCode))
|
||||
}
|
||||
r, err := ioutil.ReadAll(rsp.Body)
|
||||
r, err := io.ReadAll(rsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -574,7 +573,7 @@ func verifyMetric(expected, srvAddr string) error {
|
||||
if rsp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("failed to get response from serve: %s", http.StatusText(rsp.StatusCode))
|
||||
}
|
||||
r, err := ioutil.ReadAll(rsp.Body)
|
||||
r, err := io.ReadAll(rsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
@@ -108,7 +108,7 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitHandler) {
|
||||
http.Error(w, msg, http.StatusBadRequest)
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadAll(r.Body)
|
||||
data, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("Request could not be decoded: %v", err)
|
||||
klog.Error(msg)
|
||||
|
Reference in New Issue
Block a user