fix: discard http unsuccessful status

This commit is contained in:
Skyxim 2023-07-16 11:43:18 +08:00
parent a181e35865
commit cbb8ef5dfe

View file

@ -57,7 +57,7 @@ func (h *HTTPVehicle) Read() ([]byte, error) {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode < 200 && resp.StatusCode > 299 {
if resp.StatusCode < 200 || resp.StatusCode > 299 {
return nil, errors.New(resp.Status)
}
buf, err := io.ReadAll(resp.Body)