增加 post超时

master
dengsgo 2019-01-03 09:54:25 +08:00
parent 87cde6a03a
commit 3ffa24d4fa
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"log"
"net/http"
"strings"
"time"
)
type postParams struct {
@ -50,7 +51,9 @@ func (n *NetNotifier) dispatch(params *postParams) {
log.Println("error: json.Marshal n.params. ", err)
return
}
client := &http.Client{}
client := &http.Client{
Timeout: time.Second * 15,
}
req, err := http.NewRequest("POST", n.CallUrl, bytes.NewBuffer(b))
if err != nil {
log.Println("error: http.NewRequest. ", err)