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:
parent
0128d74f34
commit
2c9e5fe47a
@ -30,7 +30,12 @@ func (i interceptedWriter) WriteHeader(code int) {
|
||||
func TestContextFormFileFailed17(t *testing.T) {
|
||||
buf := new(bytes.Buffer)
|
||||
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.Request, _ = http.NewRequest("POST", "/", nil)
|
||||
c.Request.Header.Set("Content-Type", mw.FormDataContentType())
|
||||
|
@ -100,7 +100,7 @@ func TestH2c(t *testing.T) {
|
||||
|
||||
url := "http://" + ln.Addr().String() + "/"
|
||||
|
||||
http := http.Client{
|
||||
httpClient := http.Client{
|
||||
Transport: &http2.Transport{
|
||||
AllowHTTP: true,
|
||||
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 {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user