Report error response body in HTTP helper
In https://github.com/elastic/beats/blob/main/metricbeat/helper/http.go#L179 we don't report the body of the response when an error happens, making it harder to understand why the particular HTTP request failed. This can sometimes make it harder to capture errors that are transient.
It would be great if we could read the body stream and print that out as well with the error.
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)
Hi! We just realized that we haven't looked into this issue in a while. We're sorry!
We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!