Catch HEAD errors (#1460)

This commit is contained in:
Tomas Della Vedova
2021-05-03 16:40:09 +02:00
committed by GitHub
parent dc2de57bd3
commit d5f61c7833
2 changed files with 6 additions and 4 deletions

View File

@ -306,8 +306,8 @@ class Transport {
return callback(err, result)
}
} else {
// cast to boolean if the request method was HEAD
result.body = isHead === true ? true : payload
// cast to boolean if the request method was HEAD and there was no error
result.body = isHead === true && result.statusCode < 400 ? true : payload
}
// we should ignore the statusCode if the user has configured the `ignore` field with