diff options
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r-- | cli/dts/lib.deno.unstable.d.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index d23536c42..a7203f778 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -1214,4 +1214,45 @@ declare namespace Deno { * The pid of the current process's parent. */ export const ppid: number; + + /** **UNSTABLE**: New API, yet to be vetted. + * A custom HttpClient for use with `fetch`. + * + * ```ts + * const client = new Deno.createHttpClient({ caFile: "./ca.pem" }); + * const req = await fetch("https://myserver.com", { client }); + * ``` + */ + export class HttpClient { + rid: number; + close(): void; + } + + /** **UNSTABLE**: New API, yet to be vetted. + * The options used when creating a [HttpClient]. + */ + interface CreateHttpClientOptions { + /** A certificate authority to use when validating TLS certificates. + * + * Requires `allow-read` permission. + */ + caFile?: string; + } + + /** **UNSTABLE**: New API, yet to be vetted. + * Create a custom HttpClient for to use with `fetch`. + * + * ```ts + * const client = new Deno.createHttpClient({ caFile: "./ca.pem" }); + * const req = await fetch("https://myserver.com", { client }); + * ``` + */ + export function createHttpClient( + options: CreateHttpClientOptions, + ): HttpClient; } + +declare function fetch( + input: Request | URL | string, + init?: RequestInit & { client: Deno.HttpClient }, +): Promise<Response>; |