From f076f3a88abb4ea6c51beb6d79271fdb37212b7a Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 21 Nov 2019 23:00:42 +0100 Subject: [PATCH] replace bytes.NewBufferString() with strings.NewReader() --- internal/reqdata/store_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/reqdata/store_test.go b/internal/reqdata/store_test.go index 2694e6b..7216753 100644 --- a/internal/reqdata/store_test.go +++ b/internal/reqdata/store_test.go @@ -1,11 +1,11 @@ package reqdata import ( - "bytes" "fmt" "net/http" "net/http/httptest" "reflect" + "strings" "testing" ) @@ -301,7 +301,7 @@ func TestStoreWithUrlEncodedForm(t *testing.T) { for i, test := range tests { t.Run(fmt.Sprintf("request.%d", i), func(t *testing.T) { - body := bytes.NewBufferString(test.URLEncoded) + body := strings.NewReader(test.URLEncoded) req := httptest.NewRequest(http.MethodPost, "http://host.com", body) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") defer req.Body.Close() @@ -474,7 +474,7 @@ func TestJsonParameters(t *testing.T) { for i, test := range tests { t.Run(fmt.Sprintf("request.%d", i), func(t *testing.T) { - body := bytes.NewBufferString(test.RawJson) + body := strings.NewReader(test.RawJson) req := httptest.NewRequest(http.MethodPost, "http://host.com", body) req.Header.Add("Content-Type", "application/json") defer req.Body.Close() @@ -709,7 +709,7 @@ x for i, test := range tests { t.Run(fmt.Sprintf("request.%d", i), func(t *testing.T) { - body := bytes.NewBufferString(test.RawMultipart) + body := strings.NewReader(test.RawMultipart) req := httptest.NewRequest(http.MethodPost, "http://host.com", body) req.Header.Add("Content-Type", "multipart/form-data; boundary=xxx") defer req.Body.Close()