chore(update): check the HTTP response status code before reading the body

This commit is contained in:
verse91
2026-05-10 01:14:12 +07:00
parent 21bd993469
commit ffb9799402
+4
View File
@@ -90,6 +90,10 @@ func FetchLatestVersion() (string, error) {
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("unexpected status code: %d", resp.StatusCode)
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", err