fix gosec G307

This commit is contained in:
naiba 2023-02-12 21:10:34 +08:00
parent dfb9bd10f6
commit ff8bf16171

View File

@ -149,7 +149,9 @@ func (ns *NotificationServerBundle) Send(message string) error {
}
if resp.StatusCode < 200 || resp.StatusCode > 299 {
defer resp.Body.Close()
defer func() {
_ = resp.Body.Close()
}()
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("%d@%s %s", resp.StatusCode, resp.Status, string(body))
}