Documentation
¶
Overview ¶
Package dependency turns the errors of third-party packages into errors of this module and keeps the module's own HTTP calls from following redirects. Its functions are safe for concurrent use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error returns "<operation>: <err>" with err's message but without its chain, so callers cannot start matching on a dependency's errors (LIB-010). A cancelled or expired context stays detectable: when err matches context.Canceled or context.DeadlineExceeded, that standard library sentinel is wrapped and its text appended. An HTTP call's *url.Error in err is reduced to `<operation>: <method> "<scheme>://<host>": <TransportFailure>`: its URL's path and query may carry personal data and its transport text may repeat bytes the server sent [LOG-009].
func TransportFailure ¶
TransportFailure reduces the error of an HTTP transport to what is safe to record: the text of a malformed answer repeats the server's bytes (a header line, a status line), which may be personal data [LOG-009]. context.Canceled and context.DeadlineExceeded (also an http.Client timeout) are returned as they are, a refused redirect (WithoutRedirects) is "redirect refused", a dial error keeps its text (address and system error), another timeout is "timeout"; anything else is named by the type of its innermost error. The result carries no dependency's type.
func WithoutRedirects ¶
WithoutRedirects returns a copy of client that fails a call answered with a redirect instead of following it. net/http resends a 307 or 308 request with its body and, to the same host, its Authorization header, also from https to http: a token request would hand the client secret, the code and the PKCE verifier to a plain-http or foreign endpoint that no URL check of this module has seen (design D16). The error is a *url.Error naming the redirect's target, which Error reduces to `<operation>: <method> "<target origin>": redirect refused`.
Types ¶
This section is empty.