Documentation
¶
Overview ¶
Package httpreq issues the service's outgoing HTTP requests with the trace context and the baggage of the caller attached.
It exists because the two Rancher drivers repeated the same four steps -- build, send, read, check the status -- around a request library that could not carry a context. Propagation has to happen on each of those calls, and a dozen copies of the same injection is a dozen chances to forget it.
Deliberately thin: it returns the status code and the raw body rather than decoding or classifying anything. The callers differ in what a status means to them -- a 404 while deleting is success, a 404 while looking a workload up is not -- so that judgement stays with them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
func Do ¶
Do sends the request and reads the whole response.
Unlike the request library this replaced, a transport failure is returned as an error before the status is looked at. The old call sites read resp.StatusCode first and only then checked the error, which dereferences nil whenever the peer is unreachable.