# README
httpClient
a simple client to make remote http request and return string response body
currently supported method:
- Get
- Put (content type: json)
- Post (content type: json)
- Delete (content type: json)
example code
package any
import (
"github.com/stretchr/testify/assert"
"github.com/winjeg/go-commons/httpclient"
)
func TestGet(t *testing.T) {
d, err := httpclient.Get("https://www.baidu.com")
assert.Equal(*t, err == nil, true)
assert.Equal(*t, len(d) > 0, true)
_, err = httpclient.Post("https://www.baidu.com", `{"abc":"def"}`)
assert.NotNil(*t, err)
}