Revert to using strings for simplicity
It is safe in this case. * gock.BodyString(body string) coerces body into a []byte * client.SetData() eventually resolves to a call to http.Client.Do(), which handles the string gracefully as well.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package client_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
gock "gopkg.in/h2non/gock.v1"
|
||||
@@ -21,7 +21,7 @@ func TestSetDataSuccessOnCorrectRequest(t *testing.T) {
|
||||
"http://localhost:8080",
|
||||
"HANDLER_FOO",
|
||||
"/response/status/code",
|
||||
bytes.NewReader([]byte("200")),
|
||||
strings.NewReader("200"),
|
||||
); err != nil {
|
||||
t.Error("Unexpected error")
|
||||
}
|
||||
@@ -42,7 +42,7 @@ func TestSetDataErrIfBadHandlerID(t *testing.T) {
|
||||
"http://localhost:8080",
|
||||
"HANDLER_BAD",
|
||||
"/response/status/code",
|
||||
bytes.NewReader([]byte("200")),
|
||||
strings.NewReader("200"),
|
||||
); err == nil {
|
||||
t.Error("Expected error not present")
|
||||
} else if err.Error() != "Not Found" {
|
||||
|
||||
Reference in New Issue
Block a user