Provider-neutral HTTP helpers shared by the bundled Req-based adapters.
Layer B helper. Every function here was previously a private copy inside
one or more provider adapters with the same behaviour in each copy; this
module is the single home for those copies. The functions are
@doc false seams: they carry a @spec and are callable from tests, but
are not part of the public API.
Credential redaction is per provider: a pattern inherited from a sibling
provider redacts nothing. The patterns live once each in
ALLM.Providers.Support.Redact, one function per provider. Helpers here
that redact take that function (or an adapter's wrapper around it) as an
argument, and any provider name in a message is rendered by the caller.
Contents
- Response headers:
header_value/2,retry_after_ms/1. - Error bodies:
decode_error_body/1(a map passes through, anything else is%{}),decode_json_error_body/1(additionally JSON-decodes a binary body, for providers that send JSON astext/plain),error_object/1,body_error_message/2,redacted_error_message/3,redact_optional/2,sanitize_cause/1. - Error metadata:
build_metadata/2. - Request bodies:
stringify_keys/1. Reqrequest options:maybe_apply_req_test_stub/2,maybe_apply_request_timeout/2(leaves the request unchanged withoutopts[:request_timeout]) andapply_receive_timeout/3(applies the caller's default instead).