Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/cli/dts/lib.deno.unstable.d.ts>Deno.createHttpClient

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.createHttpClient
import { Deno } from "https://deno.land/x/deno@v1.28.0/cli/dts/lib.deno.unstable.d.ts";
const { createHttpClient } = Deno;

UNSTABLE: New API, yet to be vetted.

Create a custom HttpClient for 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().

const caCert = await Deno.readTextFile("./ca.pem");
const client = Deno.createHttpClient({ caCerts: [ caCert ] });
const response = await fetch("https://myserver.com", { client });
const client = Deno.createHttpClient({
  proxy: { url: "http://myproxy.com:8080" }
});
const response = await fetch("https://myserver.com", { client });