添加钉钉通知
This commit is contained in:
20
libs/http.go
20
libs/http.go
@@ -13,6 +13,7 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"io"
|
||||
)
|
||||
|
||||
type AjaxReturn struct {
|
||||
@@ -56,3 +57,22 @@ func HttpGet(url string, param map[string]string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func HttpPost(url string, contentType string, body io.Reader) error {
|
||||
|
||||
resp, err := http.Post(url, contentType, body)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
_, resErr := ioutil.ReadAll(resp.Body)
|
||||
|
||||
if resErr != nil {
|
||||
return resErr
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user