From c985cedb669492079d32236335842034152eb3b6 Mon Sep 17 00:00:00 2001 From: Bruce Date: Wed, 19 Sep 2018 15:43:22 +0800 Subject: [PATCH] test http post --- playground/http/upload_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/playground/http/upload_test.go b/playground/http/upload_test.go index 50fc56f..4338e04 100644 --- a/playground/http/upload_test.go +++ b/playground/http/upload_test.go @@ -23,8 +23,9 @@ func TestUploadFormFile(t *testing.T) { } // create form data - var body bytes.Buffer - writer := multipart.NewWriter(&body) + body := new(bytes.Buffer) + //body := &bytes.Buffer{} + writer := multipart.NewWriter(body) formFile, err := writer.CreateFormFile("file", filepath.Base(filePath)) if err != nil { t.Fatal(err) @@ -35,7 +36,7 @@ func TestUploadFormFile(t *testing.T) { writer.Close() // create http post request - req, err := http.NewRequest(http.MethodPost, url, &body) + req, err := http.NewRequest(http.MethodPost, url, body) if err != nil { t.Fatal(err) }