1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 14:40:57 +00:00

Merge pull request #2285 from cat2neat/fix-bodyclose

Fix http body may not be closed
This commit is contained in:
astaxie 2016-11-20 19:48:09 +08:00 committed by GitHub
commit 24015e9ace
2 changed files with 2 additions and 2 deletions

View File

@ -56,10 +56,10 @@ func (s *JLWriter) WriteMsg(when time.Time, msg string, level int) error {
if err != nil { if err != nil {
return err return err
} }
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return fmt.Errorf("Post webhook failed %s %d", resp.Status, resp.StatusCode) return fmt.Errorf("Post webhook failed %s %d", resp.Status, resp.StatusCode)
} }
resp.Body.Close()
return nil return nil
} }

View File

@ -44,10 +44,10 @@ func (s *SLACKWriter) WriteMsg(when time.Time, msg string, level int) error {
if err != nil { if err != nil {
return err return err
} }
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return fmt.Errorf("Post webhook failed %s %d", resp.Status, resp.StatusCode) return fmt.Errorf("Post webhook failed %s %d", resp.Status, resp.StatusCode)
} }
resp.Body.Close()
return nil return nil
} }