summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.unstable.d.ts
diff options
context:
space:
mode:
authorTomofumi Chiba <tomofumi.chiba@gmail.com>2021-06-22 12:21:57 +0900
committerGitHub <noreply@github.com>2021-06-22 05:21:57 +0200
commit4f1b1903cfadeeba24e1b0448879fe12682effb9 (patch)
tree5adf8bd7af8b86052ef555ca7f6ae221515baec0 /cli/dts/lib.deno.unstable.d.ts
parent580c9f9ef02f8e8226437137867d3edeb9241b5e (diff)
feat(fetch): add programmatic proxy (#10907)
This commit adds new options to unstable "Deno.createHttpClient" API. "proxy" and "basicAuth" options were added that allow to use custom proxy when client instance is passed to "fetch" API.
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index 828211c5b..1d01a748e 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -1089,6 +1089,17 @@ declare namespace Deno {
/** A certificate authority to use when validating TLS certificates. Certificate data must be PEM encoded.
*/
caData?: string;
+ proxy?: Proxy;
+ }
+
+ export interface Proxy {
+ url: string;
+ basicAuth?: BasicAuth;
+ }
+
+ export interface BasicAuth {
+ username: string;
+ password: string;
}
/** **UNSTABLE**: New API, yet to be vetted.
@@ -1096,7 +1107,12 @@ declare namespace Deno {
*
* ```ts
* const client = Deno.createHttpClient({ caData: await Deno.readTextFile("./ca.pem") });
- * const req = await fetch("https://myserver.com", { client });
+ * const response = await fetch("https://myserver.com", { client });
+ * ```
+ *
+ * ```ts
+ * const client = Deno.createHttpClient({ proxy: { url: "http://myproxy.com:8080" } });
+ * const response = await fetch("https://myserver.com", { client });
* ```
*/
export function createHttpClient(