// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
// @ts-check
///
///
///
///
///
///
///
///
"use strict";
((window) => {
const core = window.Deno.core;
/**
* @param {Deno.CreateHttpClientOptions} options
* @returns {HttpClient}
*/
function createHttpClient(options) {
options.caCerts ??= [];
return new HttpClient(core.opSync("op_fetch_custom_client", options));
}
class HttpClient {
/**
* @param {number} rid
*/
constructor(rid) {
this.rid = rid;
}
close() {
core.close(this.rid);
}
}
window.__bootstrap.fetch ??= {};
window.__bootstrap.fetch.createHttpClient = createHttpClient;
window.__bootstrap.fetch.HttpClient = HttpClient;
})(globalThis);