diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-08-05 20:44:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 20:44:03 +0200 |
commit | ce7808baf092e130ba1c5f073544072c5db958e7 (patch) | |
tree | cc8f9a167973aed549194c4ac5c8291a82c17cdf /cli/dts/lib.deno.unstable.d.ts | |
parent | 91ed614aa80f5a08669be3fe5031a95e6e75f194 (diff) |
feat(cli): custom http client for fetch (#6918)
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>; |