-func Put(url string, body []byte) error {
- if req, reqErr := http.NewRequest(http.MethodPut, url, bytes.NewBuffer(body)); reqErr == nil {
- req.Header.Set("Content-Type", "application/json; charset=utf-8")
- if response, respErr := Client.Do(req); respErr == nil {
+func Put(url string, body []byte, client HTTPClient) error {
+ return do(http.MethodPut, url, body, client)
+}
+
+func Post(url string, body []byte, client HTTPClient) error {
+ return do(http.MethodPost, url, body, client)
+}
+
+func do(method string, url string, body []byte, client HTTPClient) error {
+ if req, reqErr := http.NewRequest(method, url, bytes.NewBuffer(body)); reqErr == nil {
+ req.Header.Set("Content-Type", "application/json")
+ if response, respErr := client.Do(req); respErr == nil {