function Deno.createHttpClient
Unstable
createHttpClient(options: CreateHttpClientOptions): HttpClient
UNSTABLE: New API, yet to be vetted.
Create a custom HttpClient to use with fetch
. This is an
extension of the web platform Fetch API which allows Deno to use custom
TLS certificates and connect via a proxy while using fetch()
.
options: CreateHttpClientOptions
createHttpClient(options: CreateHttpClientOptions & TlsCertifiedKeyOptions): HttpClient
UNSTABLE: New API, yet to be vetted.
Create a custom HttpClient to use with fetch
. This is an
extension of the web platform Fetch API which allows Deno to use custom
TLS certificates and connect via a proxy while using fetch()
.
▶Example 1
Example 1
const caCert = await Deno.readTextFile("./ca.pem"); // Load a client key and certificate that we'll use to connect const key = await Deno.readTextFile("./key.key"); const cert = await Deno.readTextFile("./cert.crt"); const client = Deno.createHttpClient({ caCerts: [ caCert ], key, cert }); const response = await fetch("https://myserver.com", { client });
options: CreateHttpClientOptions & TlsCertifiedKeyOptions