fix(env): correct logic for successful HTTP request

Resolves #2147
Resolves #2148
This commit is contained in:
Jan De Dobbeleer 2022-04-25 09:32:40 +02:00 committed by Jan De Dobbeleer
parent 00aea0decd
commit 56af13e140

View file

@ -607,7 +607,7 @@ func (env *ShellEnvironment) HTTPRequest(targetURL string, timeout int, requestM
return nil, err
}
// anything inside the range [200, 299] is considered a success
if response.StatusCode >= 200 && response.StatusCode < 300 {
if response.StatusCode < 200 || response.StatusCode >= 300 {
message := "HTTP status code " + strconv.Itoa(response.StatusCode)
err := errors.New(message)
env.log(Error, "HTTPRequest", message)