Merge pull request #3 from jason-gao/master

fix:callback url request fail error deal
This commit is contained in:
刘邓 2019-01-08 13:54:55 +08:00 committed by GitHub
commit 4d0bc0886d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,15 @@ func (n *NetNotifier) dispatch(params *postParams) {
req.Header.Set("Content-Type", "application/json;charset=UTF-8")
req.Header.Set("User-Agent", "FileBoy Net Notifier v1.5")
resp, err := client.Do(req)
defer resp.Body.Close()
if err != nil {
log.Println("notifier call failed. err:", err)
return
}
defer func() {
if resp != nil && resp.Body != nil {
_ = resp.Body.Close()
}
}()
if resp.StatusCode >= 300 {
// todo retry???
}