rename variable because collide with the imported package name (#3298)

* rename variable because collide with the imported package name

* handle unhandled error in context_1.17_test.go
This commit is contained in:
Amir Hossein 2022-09-01 06:51:27 +04:30 committed by GitHub
parent 0128d74f34
commit 2c9e5fe47a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -30,7 +30,12 @@ func (i interceptedWriter) WriteHeader(code int) {
func TestContextFormFileFailed17(t *testing.T) { func TestContextFormFileFailed17(t *testing.T) {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
mw := multipart.NewWriter(buf) mw := multipart.NewWriter(buf)
mw.Close() defer func(mw *multipart.Writer) {
err := mw.Close()
if err != nil {
assert.Error(t, err)
}
}(mw)
c, _ := CreateTestContext(httptest.NewRecorder()) c, _ := CreateTestContext(httptest.NewRecorder())
c.Request, _ = http.NewRequest("POST", "/", nil) c.Request, _ = http.NewRequest("POST", "/", nil)
c.Request.Header.Set("Content-Type", mw.FormDataContentType()) c.Request.Header.Set("Content-Type", mw.FormDataContentType())

View File

@ -100,7 +100,7 @@ func TestH2c(t *testing.T) {
url := "http://" + ln.Addr().String() + "/" url := "http://" + ln.Addr().String() + "/"
http := http.Client{ httpClient := http.Client{
Transport: &http2.Transport{ Transport: &http2.Transport{
AllowHTTP: true, AllowHTTP: true,
DialTLS: func(netw, addr string, cfg *tls.Config) (net.Conn, error) { DialTLS: func(netw, addr string, cfg *tls.Config) (net.Conn, error) {
@ -109,7 +109,7 @@ func TestH2c(t *testing.T) {
}, },
} }
res, err := http.Get(url) res, err := httpClient.Get(url)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }