From c99b84ccfaeed5fa46a04cd063c9f84a881d4759 Mon Sep 17 00:00:00 2001 From: Kamandlou Date: Thu, 1 Sep 2022 17:14:35 +0430 Subject: [PATCH] handle unhandled error in context_test.go --- context_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/context_test.go b/context_test.go index b3e81c14..3c0704c8 100644 --- a/context_test.go +++ b/context_test.go @@ -42,7 +42,7 @@ func createMultipartRequest() *http.Request { boundary := "--testboundary" body := new(bytes.Buffer) mw := multipart.NewWriter(body) - defer mw.Close() + defer must(mw.Close()) must(mw.SetBoundary(boundary)) must(mw.WriteField("foo", "bar")) @@ -76,7 +76,7 @@ func TestContextFormFile(t *testing.T) { _, err = w.Write([]byte("test")) assert.NoError(t, err) } - mw.Close() + must(mw.Close()) c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", buf) c.Request.Header.Set("Content-Type", mw.FormDataContentType()) @@ -97,7 +97,7 @@ func TestContextMultipartForm(t *testing.T) { _, err = w.Write([]byte("test")) assert.NoError(t, err) } - mw.Close() + must(mw.Close()) c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", buf) c.Request.Header.Set("Content-Type", mw.FormDataContentType()) @@ -112,7 +112,7 @@ func TestContextMultipartForm(t *testing.T) { func TestSaveUploadedOpenFailed(t *testing.T) { buf := new(bytes.Buffer) mw := multipart.NewWriter(buf) - mw.Close() + must(mw.Close()) c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", buf) @@ -132,7 +132,7 @@ func TestSaveUploadedCreateFailed(t *testing.T) { _, err = w.Write([]byte("test")) assert.NoError(t, err) } - mw.Close() + must(mw.Close()) c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", buf) c.Request.Header.Set("Content-Type", mw.FormDataContentType())