Documentation
¶
Overview ¶
Package httpx gives each HTTP caller a transport of its own. A CloseIdleConnections on the process-wide http.DefaultTransport, which every httptest.Server.Close also does, breaks a caller's connections parked there (#287, #531, #564), so production code never uses http.DefaultClient or http.DefaultTransport (a forbidigo rule in .golangci.yml enforces it).
Index ¶
Constants ¶
const DrainLimit = 4 << 10
DrainLimit is the most of an unread response body that CloseBody discards.
Variables ¶
This section is empty.
Functions ¶
func Client ¶
Client returns a client over a new Transport; a zero timeout means none, as for http.DefaultClient.
func CloseBody ¶ added in v0.4.0
func CloseBody(body io.ReadCloser)
CloseBody discards at most DrainLimit bytes of body and closes it. A body read to EOF returns its keep-alive connection to the pool; a longer one closes the connection, so an unbounded answer is never read in full.
func NodeClient ¶ added in v0.4.0
NodeClient returns a client over a new NodeTransport; a zero timeout means none.
func NodeTransport ¶ added in v0.4.0
NodeTransport returns a new transport, with a connection pool of its own, for calls that never leave this node: function and pool workers, provider engines and the daemon's own node-private servers (ADR-0155). Concurrent calls to one host reuse keep-alive connections (ADR-0041), and no proxy is used.
Types ¶
This section is empty.