If the endpoint is unresponsive due to an outage, http.Client.Do can yield error. We must handle this error, or we would access an undefined response and traps segfault and crashes the daemon.
This PR also adds a test to catch this situation.
An error is returned if caused by client policy (such as CheckRedirect), or failure to speak HTTP (such as a network connectivity problem). A non-2xx status code doesn't cause an error.
https://pkg.go.dev/net/http#Client.Do
If the endpoint is unresponsive due to an outage,
http.Client.Do
can yield error. We must handle this error, or we would access an undefined response and traps segfault and crashes the daemon.This PR also adds a test to catch this situation.