A function between the @http queue and the network. It receives the
request as it is about to go out (after the injectors, with the default
user-agent and accept-encoding filled in and the body encoded as it
is sent), who makes it, and send, which performs the real request. It
may call send (as is, or with a changed request) or return a Response
of its own without touching the network. Whatever send throws (a
timeout, a connection error) passes through unless the transport catches
it.
Of the errors a transport lets through, only one that send rejected with
is retried, as a failed connection is, and only when the transport rethrows
it as is. Any other error the transport throws is its own, whether before
send (a replay without a recording) or after it (a recorder whose disk is
full), and fails the request at once without a retry, so a park that has
already answered is not asked again. A missing or already read Response
fails the same way. The caller receives an HttpTransportError, and a
request whose injector lets one through from a nested request fails
without a retry as well.
Rules for a transport:
Read a body only from response.clone(). The Response it returns
must be unread, because parksapi reads it afterwards.
The request carries secrets: auth headers, proxy keys and forwarded
headers in the URL, proxyUrl, an mTLS key, the credentials in the
body of a sign-in, whose response carries a token. caller.args can
carry credentials too. Redact a copy before storing anything.
redactUrlSecrets(request.url) masks what the URL carries of them:
the proxy keys, the forwarded headers and the credential query
parameters.
What it returns is cached like a network response when the method
caches.
The timeout applies inside send only. A request from the queue holds
its slot in the concurrency limit while the transport runs, so the
transport must end on its own, must not call an @http method itself,
and should not take longer than the request it replaces.
A function between the
@httpqueue and the network. It receives the request as it is about to go out (after the injectors, with the defaultuser-agentandaccept-encodingfilled in and the body encoded as it is sent), who makes it, andsend, which performs the real request. It may callsend(as is, or with a changed request) or return aResponseof its own without touching the network. Whateversendthrows (a timeout, a connection error) passes through unless the transport catches it.Of the errors a transport lets through, only one that
sendrejected with is retried, as a failed connection is, and only when the transport rethrows it as is. Any other error the transport throws is its own, whether beforesend(a replay without a recording) or after it (a recorder whose disk is full), and fails the request at once without a retry, so a park that has already answered is not asked again. A missing or already read Response fails the same way. The caller receives anHttpTransportError, and a request whose injector lets one through from a nested request fails without a retry as well.Rules for a transport:
response.clone(). TheResponseit returns must be unread, because parksapi reads it afterwards.proxyUrl, an mTLSkey, the credentials in the body of a sign-in, whose response carries a token.caller.argscan carry credentials too. Redact a copy before storing anything.redactUrlSecrets(request.url)masks what the URL carries of them: the proxy keys, the forwarded headers and the credential query parameters.sendonly. A request from the queue holds its slot in the concurrency limit while the transport runs, so the transport must end on its own, must not call an@httpmethod itself, and should not take longer than the request it replaces.