diff --git a/internal/authentication/credentials/hibp.go b/internal/authentication/credentials/hibp.go index 99d7f76..a14dd7a 100644 --- a/internal/authentication/credentials/hibp.go +++ b/internal/authentication/credentials/hibp.go @@ -39,12 +39,16 @@ func IsPasswordPwned(password string) (bool, error) { log.L.Fatalf("Request failed with HTTP %s.", resp.Status) } - defer resp.Body.Close() bodyText, err := io.ReadAll(resp.Body) if err != nil { log.L.Fatal(err) } + err = resp.Body.Close() + if err != nil { + log.L.Warnf("Failed to close file: %s.", err) + } + bodyStr := string(bodyText) lines := strings.Split(bodyStr, "\n")