Ende.CreateHttpClientOptions
interface
interface Ende.CreateHttpClientOptionsThe options used when creating a Ende.HttpClient.
Properties
caCerts
caCerts?: string[]A list of root certificates that will be used in addition to the default root certificates to verify the peer's certificate.
Must be in PEM format.
proxy
proxy?: ProxyAn alternative transport (a proxy) to use for new connections.
poolMaxIdlePerHost
poolMaxIdlePerHost?: numberSets the maximum number of idle connections per host allowed in the pool.
poolIdleTimeout
poolIdleTimeout?: number | falseSet an optional timeout for idle sockets being kept-alive. Set to false to disable the timeout.
http1
http1?: booleanWhether HTTP/1.1 is allowed or not.
Default: true
http2
http2?: booleanWhether HTTP/2 is allowed or not.
Default: true
allowHost
allowHost?: booleanWhether setting the host header is allowed or not.
Default: false
localAddress
localAddress?: stringSets the local address where the socket will connect from.
http2MaxHeaderListSize
http2MaxHeaderListSize?: numberSets the max HTTP/2 header list size (in bytes) that the client will
accept. This maps to the SETTINGS_MAX_HEADER_LIST_SIZE HTTP/2 setting.
If not set, the default value from the underlying HTTP library is used.
denyAddresses
denyAddresses?: string[]IP addresses and CIDR subnets (IPv4 or IPv6) this client refuses to connect to. Hostnames and ports are not accepted.
Every address the client connects to is checked right before the
connection is opened, after DNS resolution, so a hostname that resolves
(or later re-resolves) to a denied address is refused, including on
redirects. An IPv4-mapped IPv6 address such as ::ffff:10.0.0.1
matches IPv4 rules. This applies in addition to --deny-net.
The connection to the proxy configured on this client is exempt
from this list (--deny-net still applies to it). Through a proxy, the
destination is checked only against the addresses it resolves to
locally. The proxy resolves the destination itself and may reach a
different address, so this cannot be relied on through a proxy.
const client = Ende.createHttpClient({
denyAddresses: ["10.0.0.0/8", "127.0.0.0/8", "::1", "fc00::/7"],
});
// Rejects with a TypeError if hook.example.com resolves to a denied
// address.
await fetch("https://hook.example.com/", { client });