Avoid io/ioutil

This commit is contained in:
Tatsuhiro Tsujikawa 2022-05-24 18:52:30 +09:00
parent 26ef62d613
commit 31b5eb597d
2 changed files with 3 additions and 5 deletions

View File

@ -8,7 +8,6 @@ import (
"golang.org/x/net/http2" "golang.org/x/net/http2"
"golang.org/x/net/http2/hpack" "golang.org/x/net/http2/hpack"
"io" "io"
"io/ioutil"
"net" "net"
"net/http" "net/http"
"regexp" "regexp"
@ -601,7 +600,7 @@ func TestH2H1ChunkedRequestBody(t *testing.T) {
if got := fmt.Sprint(r.TransferEncoding); got != want { if got := fmt.Sprint(r.TransferEncoding); got != want {
t.Errorf("Transfer-Encoding: %v; want %v", got, want) t.Errorf("Transfer-Encoding: %v; want %v", got, want)
} }
body, err := ioutil.ReadAll(r.Body) body, err := io.ReadAll(r.Body)
if err != nil { if err != nil {
t.Fatalf("Error reading r.body: %v", err) t.Fatalf("Error reading r.body: %v", err)
} }

View File

@ -12,7 +12,6 @@ import (
"golang.org/x/net/http2/hpack" "golang.org/x/net/http2/hpack"
"golang.org/x/net/websocket" "golang.org/x/net/websocket"
"io" "io"
"io/ioutil"
"net" "net"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
@ -430,7 +429,7 @@ func (st *serverTester) http1(rp requestParam) (*serverResponse, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
respBody, err := ioutil.ReadAll(resp.Body) respBody, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -664,7 +663,7 @@ func cloneHeader(h http.Header) http.Header {
} }
func noopHandler(w http.ResponseWriter, r *http.Request) { func noopHandler(w http.ResponseWriter, r *http.Request) {
ioutil.ReadAll(r.Body) io.ReadAll(r.Body)
} }
type APIResponse struct { type APIResponse struct {