Skip to content

Commit

Permalink
feat: add test cases for Client.Post and Client.Head
Browse files Browse the repository at this point in the history
  • Loading branch information
presbrey committed Aug 9, 2024
1 parent 52a1a72 commit 21c7f5e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,32 @@ func TestClientGetError(t *testing.T) {
assert.Contains(t, err.Error(), "invalid control character")
}

func TestClientPostError(t *testing.T) {
config := Config{
ProxyURLs: []string{"http://10.255.255.1:8080"},
DialTimeout: 5 * time.Second,
}

client, err := NewClient(config)
require.NoError(t, err)
_, err = client.Post("\000", "text/plain", nil)
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid control character")
}

func TestClientHeadError(t *testing.T) {
config := Config{
ProxyURLs: []string{"http://10.255.255.1:8080"},
DialTimeout: 5 * time.Second,
}

client, err := NewClient(config)
require.NoError(t, err)
_, err = client.Head("\000")
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid control character")
}

func TestClientNewError(t *testing.T) {
config := Config{
ProxyURLs: []string{"\000"},
Expand Down

0 comments on commit 21c7f5e

Please sign in to comment.