remove deprecated of package io/ioutil (#3395)

This commit is contained in:
Qt
2022-11-17 22:35:55 +08:00
committed by GitHub
parent 234a1d33f7
commit 6150c488e7
8 changed files with 27 additions and 31 deletions
+12 -12
View File
@@ -8,7 +8,7 @@ import (
"crypto/tls"
"fmt"
"html/template"
"io/ioutil"
"io"
"net"
"net/http"
"net/http/httptest"
@@ -76,7 +76,7 @@ func TestLoadHTMLGlobDebugMode(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -114,7 +114,7 @@ func TestH2c(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -134,7 +134,7 @@ func TestLoadHTMLGlobTestMode(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -154,7 +154,7 @@ func TestLoadHTMLGlobReleaseMode(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -181,7 +181,7 @@ func TestLoadHTMLGlobUsingTLS(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -201,7 +201,7 @@ func TestLoadHTMLGlobFromFuncMap(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "Date: 2017/07/01", string(resp))
}
@@ -232,7 +232,7 @@ func TestLoadHTMLFilesTestMode(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -252,7 +252,7 @@ func TestLoadHTMLFilesDebugMode(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -272,7 +272,7 @@ func TestLoadHTMLFilesReleaseMode(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -299,7 +299,7 @@ func TestLoadHTMLFilesUsingTLS(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
}
@@ -319,7 +319,7 @@ func TestLoadHTMLFilesFuncMap(t *testing.T) {
t.Error(err)
}
resp, _ := ioutil.ReadAll(res.Body)
resp, _ := io.ReadAll(res.Body)
assert.Equal(t, "Date: 2017/07/01", string(resp))
}