Fix http body may not be closed
This commit is contained in:
		
							parent
							
								
									27c59a8017
								
							
						
					
					
						commit
						9ff88f0b35
					
				| @ -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 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user