assertions := require.New(t)
bodyBytes, _ := json.Marshal("body")
- succesfullReq, _ := http.NewRequest(http.MethodGet, "url", bytes.NewReader(bodyBytes))
+ successfulReq, _ := http.NewRequest(http.MethodGet, "url", bytes.NewReader(bodyBytes))
type args struct {
method string
wantErr error
}{
{
- name: "succesfull newRequest",
+ name: "successful newRequest",
args: args{
method: http.MethodGet,
path: "url",
payload: "body",
userInfo: [2]string{"user", "pass"},
},
- want: succesfullReq,
+ want: successfulReq,
wantErr: nil,
},
{
client := New(&http.Client{}, false)
payload := `json:"example"`
+ // With user info
err := client.Delete(srv.URL, payload, nil, "admin", "pass")
if err != nil {
assert.Equal(t, "", err.Error())
}
+
+ // Without user info
+ err = client.Delete(srv.URL, payload, nil)
+
+ if err != nil {
+ assert.Equal(t, "", err.Error())
+ }
}