internal/client/{get,set}_test.go: send io.Writer() based on []byte

* internal/client/get_test.go:
  - Revert changes when setting the Body of the mock (gock).
  - Revert over-eager line splitting.

* internal/client/set_test.go:
  - Use bytes.NewReader([]byte("200")) instead of strings.NewReader("200")

Thanks to @nilp0inter for the feedback!
This commit is contained in:
pancho horrillo
2019-10-06 11:34:15 +02:00
parent f98784088d
commit 0b056f6cf0
2 changed files with 11 additions and 6 deletions
+2 -3
View File
@@ -13,11 +13,10 @@ func TestWriteContentToWriter(t *testing.T) {
gock.New("http://localhost").
Get("/handlers/HANDLER_BAR/request/body").
Reply(http.StatusOK).
BodyString("FOO")
Body(bytes.NewReader([]byte("FOO")))
var b bytes.Buffer
err := GetData(
"http://localhost", "HANDLER_BAR", "/request/body", &b)
err := GetData("http://localhost", "HANDLER_BAR", "/request/body", &b)
if err != nil {
t.Errorf("Unexpected error: %q", err)