fix: discard http unsuccessful status

This commit is contained in:
gVisor bot 2023-07-16 11:43:18 +08:00
parent 58583c11c9
commit a340fd260c

View file

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