Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.HttpClient

A modern runtime for JavaScript and TypeScript.
Latest
class Deno.HttpClient
implements Disposable
import { Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.d.ts";
const { HttpClient } = Deno;

A custom HttpClient for use with fetch function. This is designed to allow custom certificates or proxies to be used with fetch().

Examples

Example 1

const caCert = await Deno.readTextFile("./ca.pem");
const client = Deno.createHttpClient({ caCerts: [ caCert ] });
const req = await fetch("https://myserver.com", { client });

Methods

close(): void

Close the HTTP client.